linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 12118/12398] kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is never less than zero.
@ 2025-11-27 19:29 kernel test robot
  2025-11-29 19:51 ` Pasha Tatashin
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2025-11-27 19:29 UTC (permalink / raw)
  To: Pasha Tatashin
  Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List,
	Mike Rapoport (Microsoft),
	Pratyush Yadav

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   ef68bf704646690aba5e81c2f7be8d6ef13d7ad8
commit: b30a1fee674c8446bebd9e399b267ac824093bc8 [12118/12398] liveupdate: luo_core: add user interface
config: x86_64-randconfig-161-20251127 (https://download.01.org/0day-ci/archive/20251128/202511280300.6pvBmXUS-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511280300.6pvBmXUS-lkp@intel.com/

smatch warnings:
kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is never less than zero.

vim +/nr +402 kernel/liveupdate/luo_core.c

   392	
   393	static long luo_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
   394	{
   395		const struct luo_ioctl_op *op;
   396		struct luo_ucmd ucmd = {};
   397		union ucmd_buffer buf;
   398		unsigned int nr;
   399		int err;
   400	
   401		nr = _IOC_NR(cmd);
 > 402		if (nr < LIVEUPDATE_CMD_BASE ||
   403		    (nr - LIVEUPDATE_CMD_BASE) >= ARRAY_SIZE(luo_ioctl_ops)) {
   404			return -EINVAL;
   405		}
   406	
   407		ucmd.ubuffer = (void __user *)arg;
   408		err = get_user(ucmd.user_size, (u32 __user *)ucmd.ubuffer);
   409		if (err)
   410			return err;
   411	
   412		op = &luo_ioctl_ops[nr - LIVEUPDATE_CMD_BASE];
   413		if (op->ioctl_num != cmd)
   414			return -ENOIOCTLCMD;
   415		if (ucmd.user_size < op->min_size)
   416			return -EINVAL;
   417	
   418		ucmd.cmd = &buf;
   419		err = copy_struct_from_user(ucmd.cmd, op->size, ucmd.ubuffer,
   420					    ucmd.user_size);
   421		if (err)
   422			return err;
   423	
   424		return op->execute(&ucmd);
   425	}
   426	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-30  0:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-27 19:29 [linux-next:master 12118/12398] kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is never less than zero kernel test robot
2025-11-29 19:51 ` Pasha Tatashin
2025-11-29 20:00   ` Andrew Morton
2025-11-29 20:20     ` Pasha Tatashin
2025-11-29 23:52       ` Andrew Morton
2025-11-30  0:55         ` Pasha Tatashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox