Skip to contentSkip to conversation

io_uring: fix types in io_recvmsg_multishot_overflow

PATCH Applied Dylan Yudaken 2 participants 2 messages Jul 15, 2022 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: fix types in io_recvmsg_multishot_overflow

io_recvmsg_multishot_overflow had incorrect types on non x64 system. But also it had an unnecessary INT_MAX check, which could just be done by changing the type of the accumulator to int (also simplifying the casts).

Fixes a8b38c4ce724 ("io_uring: support multishot in recvmsg")
---
 io_uring/net.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
io_uring/net.c +5 -5
index 616d5f04cc74..6b7d5f33e642 100644
@@ -327,14 +327,14 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)
 
 static bool io_recvmsg_multishot_overflow(struct io_async_msghdr *iomsg)
 {
-	unsigned long hdr;
+	int hdr;
 
-	if (check_add_overflow(sizeof(struct io_uring_recvmsg_out),
-			       (unsigned long)iomsg->namelen, &hdr))
+	if (iomsg->namelen < 0)
 		return true;
-	if (check_add_overflow(hdr, iomsg->controllen, &hdr))
+	if (check_add_overflow((int)sizeof(struct io_uring_recvmsg_out),
+			       iomsg->namelen, &hdr))
 		return true;
-	if (hdr > INT_MAX)
+	if (check_add_overflow(hdr, (int)iomsg->controllen, &hdr))
 		return true;
 
 	return false;

base-commit: a8b38c4ce7240d869c820d457bcd51e452149510

Signature · 1 line
2.30.2
maintainer Applied
#1 lore raw
Quoted 6 lines · Dylan Yudaken

io_recvmsg_multishot_overflow had incorrect types on non x64 system. But also it had an unnecessary INT_MAX check, which could just be done by changing the type of the accumulator to int (also simplifying the casts).

Applied, thanks!

[1/1] io_uring: fix types in io_recvmsg_multishot_overflow

      commit: 184d0a67566383f4f9e85101e4af495abe86f215

Best regards,

Signature · 1 line
Jens Axboe