[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220308075717.37734-1-jiapeng.chong@linux.alibaba.com>
Date: Tue, 8 Mar 2022 15:57:17 +0800
From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To: axboe@...nel.dk
Cc: asml.silence@...il.com, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: [PATCH] io_uring: Fix an unsigned subtraction which can never be negative.
Eliminate the follow smatch warnings:
fs/io_uring.c:10358 __do_sys_io_uring_enter() warn: unsigned 'fd' is
never less than zero.
Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
---
fs/io_uring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 23e7f93d3956..d970c94804db 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10355,7 +10355,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
if (!tctx)
return -EINVAL;
if (fd != tctx->last_reg_fd) {
- if (fd < 0 || fd >= IO_RINGFD_REG_MAX || !tctx)
+ if (fd >= IO_RINGFD_REG_MAX || !tctx)
return -EINVAL;
tctx->last_reg_fd = array_index_nospec(fd,
IO_RINGFD_REG_MAX);
--
2.20.1.7.g153144c
Powered by blists - more mailing lists