public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: Fix an unsigned subtraction which can never be negative.
@ 2022-03-08  7:57 Jiapeng Chong
  2022-03-09  0:42 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2022-03-08  7:57 UTC (permalink / raw)
  To: axboe; +Cc: asml.silence, io-uring, linux-kernel, Jiapeng Chong, Abaci Robot

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 <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: Fix an unsigned subtraction which can never be negative.
  2022-03-08  7:57 [PATCH] io_uring: Fix an unsigned subtraction which can never be negative Jiapeng Chong
@ 2022-03-09  0:42 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-03-09  0:42 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: linux-kernel, io-uring, asml.silence, Abaci Robot

On Tue, 8 Mar 2022 15:57:17 +0800, Jiapeng Chong wrote:
> Eliminate the follow smatch warnings:
> 
> fs/io_uring.c:10358 __do_sys_io_uring_enter() warn: unsigned 'fd' is
> never less than zero.
> 
> 

Applied, thanks!

[1/1] io_uring: Fix an unsigned subtraction which can never be negative.
      commit: 90e80add901b03fe6f3bc5ca6481414ee9f039ab

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-09  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-08  7:57 [PATCH] io_uring: Fix an unsigned subtraction which can never be negative Jiapeng Chong
2022-03-09  0:42 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox