linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: oe-kbuild-all@lists.linux.dev,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	Pratyush Yadav <pratyush@kernel.org>
Subject: [linux-next:master 12118/12398] kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is never less than zero.
Date: Fri, 28 Nov 2025 03:29:05 +0800	[thread overview]
Message-ID: <202511280300.6pvBmXUS-lkp@intel.com> (raw)

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


             reply	other threads:[~2025-11-27 19:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 19:29 kernel test robot [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202511280300.6pvBmXUS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox