From: Dylan Yudaken <dylany@fb•com>
To: "sfr@canb•auug.org.au" <sfr@canb•auug.org.au>,
"axboe@kernel•dk" <axboe@kernel•dk>
Cc: "linux-next@vger•kernel.org" <linux-next@vger•kernel.org>,
"linux-kernel@vger•kernel.org" <linux-kernel@vger•kernel.org>
Subject: Re: linux-next: build warning after merge of the block tree
Date: Fri, 15 Jul 2022 13:08:22 +0000 [thread overview]
Message-ID: <9a60cc4f23f698075aff1e9d75393b31f3f58516.camel@fb.com> (raw)
In-Reply-To: <20220715223351.2e8c856e@canb.auug.org.au>
On Fri, 2022-07-15 at 22:33 +1000, Stephen Rothwell wrote:
> Hi all,
>
> On Fri, 15 Jul 2022 13:52:32 +1000 Stephen Rothwell
> <sfr@canb•auug.org.au> wrote:
> >
> > After merging the block tree, today's linux-next build (arm
> > multi_v7_defconfig) produced this warning:
> >
> > In file included from include/linux/slab.h:16,
> > from io_uring/net.c:5:
> > io_uring/net.c: In function 'io_recvmsg_multishot_overflow':
> > include/linux/overflow.h:67:22: warning: comparison of distinct
> > pointer types lacks a cast
> > 67 | (void) (&__a == &__b); \
> > | ^~
> > io_uring/net.c:332:13: note: in expansion of macro
> > 'check_add_overflow'
> > 332 | if (check_add_overflow(sizeof(struct
> > io_uring_recvmsg_out),
> > | ^~~~~~~~~~~~~~~~~~
> > include/linux/overflow.h:68:22: warning: comparison of distinct
> > pointer types lacks a cast
> > 68 | (void) (&__a == __d); \
> > | ^~
> > io_uring/net.c:332:13: note: in expansion of macro
> > 'check_add_overflow'
> > 332 | if (check_add_overflow(sizeof(struct
> > io_uring_recvmsg_out),
> > | ^~~~~~~~~~~~~~~~~~
> > include/linux/overflow.h:67:22: warning: comparison of distinct
> > pointer types lacks a cast
> > 67 | (void) (&__a == &__b); \
> > | ^~
> > io_uring/net.c:335:13: note: in expansion of macro
> > 'check_add_overflow'
> > 335 | if (check_add_overflow(hdr, iomsg->controllen,
> > &hdr))
> > | ^~~~~~~~~~~~~~~~~~
> >
> > Introduced by commit
> >
> > a8b38c4ce724 ("io_uring: support multishot in recvmsg")
>
> This became a build failure in my i386 defconfig build. So I have
> applied the following (probably not correct) patch that makes it
> build.
>
Thanks for this. Your patch will probably not cause much damage,
however I have suggested the below patch to io_uring since I noticed
that the current logic was a bit off
Dylan
From: Dylan Yudaken <dylany@fb•com>
Date: Fri, 15 Jul 2022 05:55:02 -0700
Subject: [PATCH for-next] 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>
---
io_uring/net.c | 10 +++++-----
1 file 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;
base-commit: a8b38c4ce7240d869c820d457bcd51e452149510
--
2.30.2
next prev parent reply other threads:[~2022-07-15 13:08 UTC|newest]
Thread overview: 110+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 3:52 linux-next: build warning after merge of the block tree Stephen Rothwell
2022-07-15 12:33 ` Stephen Rothwell
2022-07-15 13:08 ` Dylan Yudaken [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-09-09 4:48 Stephen Rothwell
2025-07-16 10:37 Stephen Rothwell
2025-07-16 10:58 ` Johannes Thumshirn
2025-07-17 2:25 ` Randy Dunlap
2025-07-08 9:11 Stephen Rothwell
2025-07-08 13:58 ` Jens Axboe
2025-06-12 3:26 Stephen Rothwell
2025-05-07 6:32 Stephen Rothwell
2025-03-31 5:37 Stephen Rothwell
2025-03-31 13:07 ` Jens Axboe
2023-06-06 4:00 Stephen Rothwell
2023-03-15 1:48 Stephen Rothwell
2023-03-15 1:54 ` Jens Axboe
2023-02-09 3:00 Stephen Rothwell
2023-01-18 3:10 Stephen Rothwell
2022-10-05 7:17 Stephen Rothwell
2022-10-05 12:19 ` Jens Axboe
2022-07-20 3:33 Stephen Rothwell
2022-07-20 12:10 ` Stephen Rothwell
2022-07-20 12:43 ` Jens Axboe
2022-07-15 12:06 Stephen Rothwell
2022-04-21 2:02 Stephen Rothwell
2022-04-21 2:03 ` Jens Axboe
2022-04-21 5:43 ` Stephen Rothwell
2021-10-19 5:39 Stephen Rothwell
2021-08-13 9:41 Stephen Rothwell
2021-08-13 13:54 ` Jens Axboe
2021-09-03 6:49 ` Stephen Rothwell
2021-09-03 13:41 ` Jens Axboe
2021-06-15 2:13 Stephen Rothwell
2021-06-15 12:22 ` Pavel Begunkov
2021-06-09 3:52 Stephen Rothwell
2021-06-09 4:28 ` Dan Williams
2021-02-24 2:31 Stephen Rothwell
2021-02-24 2:40 ` Chaitanya Kulkarni
2021-02-24 5:25 ` Chaitanya Kulkarni
2021-02-24 5:33 ` Stephen Rothwell
2021-02-24 5:38 ` Chaitanya Kulkarni
2021-02-24 10:42 ` Stephen Rothwell
2021-02-24 21:41 ` Chaitanya Kulkarni
2021-02-24 21:45 ` Randy Dunlap
2021-02-24 21:51 ` Chaitanya Kulkarni
2021-02-24 7:16 ` Chaitanya Kulkarni
2020-12-22 23:47 Stephen Rothwell
2020-12-23 0:13 ` Jens Axboe
2020-12-07 7:48 Stephen Rothwell
2020-12-03 7:39 Stephen Rothwell
2020-12-14 20:14 ` Stephen Rothwell
2020-12-21 1:30 ` Stephen Rothwell
2020-12-03 7:37 Stephen Rothwell
2020-12-14 20:13 ` Stephen Rothwell
2020-12-21 1:29 ` Stephen Rothwell
2020-11-12 4:32 Stephen Rothwell
2020-10-22 23:48 Stephen Rothwell
2020-10-23 0:30 ` Jens Axboe
2020-07-02 1:21 Stephen Rothwell
2020-07-02 4:07 ` Jens Axboe
2020-03-04 2:17 Stephen Rothwell
2020-03-04 3:01 ` Jens Axboe
2020-03-04 12:50 ` Pavel Begunkov
2020-01-31 0:16 Stephen Rothwell
2020-01-31 0:25 ` Jens Axboe
2020-01-16 0:54 Stephen Rothwell
2020-01-16 4:50 ` Jens Axboe
2019-10-18 0:51 Stephen Rothwell
2019-10-18 0:56 ` Jens Axboe
2019-10-18 0:59 ` Jens Axboe
2019-10-18 3:58 ` Stephen Rothwell
2019-08-29 3:51 Stephen Rothwell
2019-08-29 4:08 ` Stephen Rothwell
2019-08-29 15:41 ` Tejun Heo
2019-08-29 15:44 ` Jens Axboe
2019-08-09 4:00 Stephen Rothwell
2019-08-09 4:13 ` Jens Axboe
2019-08-09 6:15 ` Yuehaibing
2019-04-17 2:31 Stephen Rothwell
2019-04-17 10:05 ` Chao Yu
2019-04-17 14:03 ` Jaegeuk Kim
2019-04-18 0:57 ` Chao Yu
2019-04-18 14:01 ` Jaegeuk Kim
2019-04-19 1:14 ` Chao Yu
2018-11-08 3:31 Stephen Rothwell
2018-11-08 4:19 ` Jens Axboe
2018-09-28 1:11 Stephen Rothwell
2018-09-28 6:43 ` Omar Sandoval
2018-09-28 14:26 ` Jens Axboe
2018-05-31 3:49 Stephen Rothwell
2018-05-14 2:51 Stephen Rothwell
2018-05-14 8:29 ` Christoph Hellwig
2018-05-14 14:31 ` Jens Axboe
2017-05-10 1:24 Stephen Rothwell
2017-05-10 2:20 ` Markus Trippelsdorf
2017-05-10 3:00 ` Jens Axboe
2017-05-10 6:19 ` Markus Trippelsdorf
2017-05-10 3:26 ` Stephen Rothwell
2014-10-23 1:28 Stephen Rothwell
2014-10-23 2:14 ` Jens Axboe
2013-09-23 4:29 Stephen Rothwell
2011-05-09 3:49 Stephen Rothwell
2011-05-09 5:55 ` Tao Ma
2011-05-09 6:34 ` Jens Axboe
2010-12-20 4:31 Stephen Rothwell
2010-12-20 4:42 ` Stephen Rothwell
2010-12-20 8:12 ` Jens Axboe
2010-09-16 3:30 Stephen Rothwell
2010-04-29 6:14 Stephen Rothwell
2010-04-29 7:28 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9a60cc4f23f698075aff1e9d75393b31f3f58516.camel@fb.com \
--to=dylany@fb$(echo .)com \
--cc=axboe@kernel$(echo .)dk \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=sfr@canb$(echo .)auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox