diff options
author | Dylan Yudaken <dylany@fb.com> | 2022-07-15 15:02:52 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-07-25 02:39:18 +0200 |
commit | 9b0fc3c054ff2eb13753104884f1045b5bb3a627 (patch) | |
tree | f6090d92c971de24e4d8cc5aaf1c4fad27eaf510 /io_uring/net.c | |
parent | io_uring: Use atomic_long_try_cmpxchg in __io_account_mem (diff) | |
download | linux-9b0fc3c054ff2eb13753104884f1045b5bb3a627.tar.xz linux-9b0fc3c054ff2eb13753104884f1045b5bb3a627.zip |
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).
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Fixes: a8b38c4ce724 ("io_uring: support multishot in recvmsg")
Signed-off-by: Dylan Yudaken <dylany@fb.com>
Link: https://lore.kernel.org/r/20220715130252.610639-1-dylany@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | io_uring/net.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/io_uring/net.c b/io_uring/net.c index 616d5f04cc74..6b7d5f33e642 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -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; |