[linux-next:master 12280/13751] fs/dlm/debug_fs.c:654:15: error: 'sscanf' may overflow; destination buffer in argument 4 has size 64, but the corresponding specifier may require size 65

[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:   f2e19fd15bd7cba347ce50be71955f5cd28a6019
commit: 5054e79de99984b4f39a073534526bc7c827b1e0 [12280/13751] fs: dlm: add lkb debugfs functionality
config: hexagon-buildonly-randconfig-r006-20211112 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 63ef0e17e28827eae53133b3467bdac7d9729318)
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=5054e79de99984b4f39a073534526bc7c827b1e0
        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 5054e79de99984b4f39a073534526bc7c827b1e0
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon 

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

All errors (new ones prefixed by >>):

>> fs/dlm/debug_fs.c:654:15: error: 'sscanf' may overflow; destination buffer in argument 4 has size 64, but the corresponding specifier may require size 65 [-Werror,-Wfortify-source]
                      &lkb_id, name, &lkb_flags, &lkb_nodeid, &lkb_status);
                               ^
   1 error generated.


vim +/sscanf +654 fs/dlm/debug_fs.c

   637	
   638	static ssize_t table_write2(struct file *file, const char __user *user_buf,
   639				    size_t count, loff_t *ppos)
   640	{
   641		struct seq_file *seq = file->private_data;
   642		int n, len, lkb_nodeid, lkb_status, error;
   643		char name[DLM_RESNAME_MAXLEN] = {};
   644		struct dlm_ls *ls = seq->private;
   645		unsigned int lkb_flags;
   646		char buf[256] = {};
   647		uint32_t lkb_id;
   648	
   649		if (copy_from_user(buf, user_buf,
   650				   min_t(size_t, sizeof(buf) - 1, count)))
   651			return -EFAULT;
   652	
   653		n = sscanf(buf, "%x %" __stringify(DLM_RESNAME_MAXLEN) "s %x %d %d",
 > 654			   &lkb_id, name, &lkb_flags, &lkb_nodeid, &lkb_status);
   655		if (n != 5)
   656			return -EINVAL;
   657	
   658		len = strnlen(name, DLM_RESNAME_MAXLEN);
   659		error = dlm_debug_add_lkb(ls, lkb_id, name, len, lkb_flags,
   660					  lkb_nodeid, lkb_status);
   661		if (error)
   662			return error;
   663	
   664		return count;
   665	}
   666	

---
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