Re: [PATCH] liveupdate: luo_core: fix redundant bound check in luo_ioctl()
From: Pratyush Yadav
Date: Sun Nov 30 2025 - 17:53:47 EST
On Sat, Nov 29 2025, Pasha Tatashin wrote:
> The kernel test robot reported a Smatch warning:
> kernel/liveupdate/luo_core.c:402 luo_ioctl() warn: unsigned 'nr' is
> never less than zero.
>
> This occurs because 'nr' is unsigned and LIVEUPDATE_CMD_BASE is
> currently defined as 0, making the check (nr < LIVEUPDATE_CMD_BASE)
> always false.
>
> Remove the explicit lower bound check. The logic remains correct because
> 'nr' is unsigned; if nr is less than LIVEUPDATE_CMD_BASE, the expression
> (nr - LIVEUPDATE_CMD_BASE) will wrap around to a large positive value.
> This will inevitably be larger than ARRAY_SIZE(luo_ioctl_ops) and be
> caught by the upper bound check.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202511280300.6pvBmXUS-lkp@xxxxxxxxx/
> Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
Reviewed-by: Pratyush Yadav <pratyush@xxxxxxxxxx>
[...]
--
Regards,
Pratyush Yadav