From: Andrew Morton <akpm@linux-foundation.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: kernel test robot <lkp@intel.com>,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
"Mike Rapoport (Microsoft)" <rppt@kernel.org>,
Pratyush Yadav <pratyush@kernel.org>
Subject: Re: [linux-next:master 12118/12398] kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is never less than zero.
Date: Sat, 29 Nov 2025 15:52:21 -0800 [thread overview]
Message-ID: <20251129155221.d5f3c519747d8d492aa17462@linux-foundation.org> (raw)
In-Reply-To: <CA+CK2bBJmj3nK4QhAC5pr+5nS0vRv_5cOxAr_mohC+YreiZPcg@mail.gmail.com>
On Sat, 29 Nov 2025 15:20:51 -0500 Pasha Tatashin <pasha.tatashin@soleen.com> wrote:
> > > > 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)) {
> > >
> > > This is a false positive. The logic is designed to work generically
> > > for any base, similar to how it is handled in session ioctl and
> > > iommufd ictl. The warning only triggers because LIVEUPDATE_CMD_BASE
> > > happens to be 0 in this specific case.
> >
> > This is a difficult situation.
> >
> > In some cases smatch has found a bug, in other cases it's just being
> > irritating.
> >
> > I think there is value in smatch occasionally finding bugs, and to
> > support that we should try to rearrange false positives so that smatch
> > doesn't report on those.
> >
> > Perhaps there's some way we can do that here, without uglifying things?
>
> Yes, we can make "unsigned int nr;" signed: "int nr;", should be OK.
> Would you like me to send a fix patch with this change?
Sure, thanks. It's a bit lame using an inappropriate type but the
world won't end if we do.
next prev parent reply other threads:[~2025-11-29 23:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 19:29 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 [this message]
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=20251129155221.d5f3c519747d8d492aa17462@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--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