From: "Arnd Bergmann" <arnd@arndb.de>
To: "Pavel Begunkov" <asml.silence@gmail.com>,
"Arnd Bergmann" <arnd@kernel.org>, "Jens Axboe" <axboe@kernel.dk>
Cc: "Gabriel Krisman Bertazi" <krisman@suse.de>,
"David Wei" <dw@davidwei.uk>,
io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] io_uring/net: fix build warning for !CONFIG_COMPAT
Date: Thu, 27 Feb 2025 14:58:55 +0100 [thread overview]
Message-ID: <9ef40a88-6243-4baf-8774-e4b72bfbb2f3@app.fastmail.com> (raw)
In-Reply-To: <275033e5-d3fe-400a-9e53-de1286adb107@gmail.com>
On Thu, Feb 27, 2025, at 14:49, Pavel Begunkov wrote:
> On 2/27/25 13:20, Arnd Bergmann wrote:
>> | ^~~
>>
>> Since io_is_compat() turns into a compile-time 'false', the #ifdef
>> here is completely unnecessary, and removing it avoids the warning.
>
> I don't think __get_compat_msghdr() and other helpers are
> compiled for !COMPAT.
They are not defined without CONFIG_COMPAT. My point in the
message is that io_is_compat() turning into a compile-time
'false' value means that they also don't get called, because
compilers are really good at this type of dead code elimination.
> I'd just silence it like:
>
> if (io_is_compat(req->ctx)) {
> ret = -EFAULT;
> #ifdef CONFIG_COMPAT
> ...
> #endif CONFIG_COMPAT
> }
That seems even less readable. If you want to be explicit
about it, you could use
if (IS_ENABLED(CONFIG_COMPAT) && io_is_compat(req->ctx)) {
to replace the #ifdef, but as I wrote in the patch
description, the compile-time check is really redundant
because io_is_compat() is meant to do exactly that.
Arnd
next prev parent reply other threads:[~2025-02-27 13:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 13:20 [PATCH] io_uring/net: fix build warning for !CONFIG_COMPAT Arnd Bergmann
2025-02-27 13:49 ` Pavel Begunkov
2025-02-27 13:58 ` Arnd Bergmann [this message]
2025-02-28 12:14 ` Pavel Begunkov
2025-02-27 14:54 ` Pavel Begunkov
2025-02-27 14:57 ` 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=9ef40a88-6243-4baf-8774-e4b72bfbb2f3@app.fastmail.com \
--to=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=dw@davidwei.uk \
--cc=io-uring@vger.kernel.org \
--cc=krisman@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.