Skip to contentSkip to conversation

io_uring: Fix an unsigned subtraction which can never be negative.

PATCH Applied Jiapeng Chong 2 participants 2 messages Mar 8, 2022 – Mar 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index 23e7f93d3956..d970c94804db 100644
@@ -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);
Signature · 1 line
2.20.1.7.g153144c
maintainer Applied
#1 lore raw
Quoted 6 lines · Jiapeng Chong

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,

Signature · 1 line
Jens Axboe