* [PATCH] liveupdate: drop redundant lower-bound check in luo_session_ioctl
@ 2026-11-20 7:52 Xiaotao Zeng
2026-11-20 7:56 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Xiaotao Zeng @ 2026-11-20 7:52 UTC (permalink / raw)
To: pasha.tatashin, rppt, pratyush
Cc: kexec, linux-kernel, duanchenghao, zengxiaotao
nr is unsigned, so for cmd values below LIVEUPDATE_CMD_SESSION_BASE the
subtraction nr - LIVEUPDATE_CMD_SESSION_BASE wraps to a large value that
is already rejected by the ARRAY_SIZE() upper-bound check. The lower
bound test is therefore redundant.
Drop it so the check matches the one in luo_ioctl().
Signed-off-by: Xiaotao Zeng <zengxiaotao@kylinos.cn>
---
kernel/liveupdate/luo_session.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
index 74bc66929f4b..f1b86f701238 100644
--- a/kernel/liveupdate/luo_session.c
+++ b/kernel/liveupdate/luo_session.c
@@ -413,10 +413,8 @@ static long luo_session_ioctl(struct file *filep, unsigned int cmd,
int ret;
nr = _IOC_NR(cmd);
- if (nr < LIVEUPDATE_CMD_SESSION_BASE || (nr - LIVEUPDATE_CMD_SESSION_BASE) >=
- ARRAY_SIZE(luo_session_ioctl_ops)) {
+ if ((nr - LIVEUPDATE_CMD_SESSION_BASE) >= ARRAY_SIZE(luo_session_ioctl_ops))
return -EINVAL;
- }
ucmd.ubuffer = (void __user *)arg;
ret = get_user(ucmd.user_size, (u32 __user *)ucmd.ubuffer);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-20 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 7:52 [PATCH] liveupdate: drop redundant lower-bound check in luo_session_ioctl Xiaotao Zeng
2026-11-20 7:56 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.