[linux-next:master 412/2389] fs/ksmbd/ndr.c:70:2: warning: 'strncpy' destination unchanged after copying no bytes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   b1347210b01daa977ea980268927aa99198ceccc
commit: c2220322b4577fc32ad3b7b4ddb856bd1f8c7461 [412/2389] ksmbd: replace KSMBD_ALIGN with kernel ALIGN macro
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=c2220322b4577fc32ad3b7b4ddb856bd1f8c7461
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout c2220322b4577fc32ad3b7b4ddb856bd1f8c7461
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=parisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   In function 'ndr_write_string',
       inlined from 'ndr_encode_dos_attr' at fs/ksmbd/ndr.c:136:3:
>> fs/ksmbd/ndr.c:70:2: warning: 'strncpy' destination unchanged after copying no bytes [-Wstringop-truncation]
      70 |  strncpy(PAYLOAD_HEAD(n), value, sz);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In function 'ndr_write_string',
       inlined from 'ndr_encode_dos_attr' at fs/ksmbd/ndr.c:134:3:
>> fs/ksmbd/ndr.c:70:2: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
      70 |  strncpy(PAYLOAD_HEAD(n), value, sz);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/ksmbd/ndr.c: In function 'ndr_encode_dos_attr':
   fs/ksmbd/ndr.c:134:3: note: length computed here
     134 |   ndr_write_string(n, hex_attr, strlen(hex_attr));
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +70 fs/ksmbd/ndr.c

e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  64  
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  65  static int ndr_write_string(struct ndr *n, void *value, size_t sz)
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  66  {
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  67  	if (n->length <= n->offset + sz)
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  68  		try_to_realloc_ndr_blob(n, sz);
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  69  
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16 @70  	strncpy(PAYLOAD_HEAD(n), value, sz);
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  71  	sz++;
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  72  	n->offset += sz;
c2220322b4577f fs/ksmbd/ndr.c Hyunchul Lee 2021-06-25  73  	n->offset = ALIGN(n->offset, 2);
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  74  	return 0;
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  75  }
e2f34481b24db2 fs/cifsd/ndr.c Namjae Jeon  2021-03-16  76  

:::::: The code at line 70 was first introduced by commit
:::::: e2f34481b24db2fd634b5edb0a5bd0e4d38cc6e9 cifsd: add server-side procedures for SMB3

:::::: TO: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
:::::: CC: Steve French <stfrench@xxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux