From: Arnd Bergmann <arnd@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Pavel Begunkov <asml.silence@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Gabriel Krisman Bertazi <krisman@suse.de>,
David Wei <dw@davidwei.uk>,
io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] io_uring/net: fix build warning for !CONFIG_COMPAT
Date: Thu, 27 Feb 2025 14:20:09 +0100 [thread overview]
Message-ID: <20250227132018.1111094-1-arnd@kernel.org> (raw)
From: Arnd Bergmann <arnd@arndb.de>
A code rework resulted in an uninitialized return code when COMPAT
mode is disabled:
io_uring/net.c:722:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
722 | if (io_is_compat(req->ctx)) {
| ^~~~~~~~~~~~~~~~~~~~~~
io_uring/net.c:736:15: note: uninitialized use occurs here
736 | if (unlikely(ret))
| ^~~
Since io_is_compat() turns into a compile-time 'false', the #ifdef
here is completely unnecessary, and removing it avoids the warning.
Fixes: 685252678757 ("io_uring/net: unify *mshot_prep calls with compat")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
io_uring/net.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/io_uring/net.c b/io_uring/net.c
index bb454b9f6a4c..33e9be094131 100644
--- a/io_uring/net.c
+++ b/io_uring/net.c
@@ -224,7 +224,6 @@ static int io_net_import_vec(struct io_kiocb *req, struct io_async_msghdr *iomsg
return 0;
}
-#ifdef CONFIG_COMPAT
static int io_compat_msg_copy_hdr(struct io_kiocb *req,
struct io_async_msghdr *iomsg,
struct compat_msghdr *msg, int ddir,
@@ -263,7 +262,6 @@ static int io_compat_msg_copy_hdr(struct io_kiocb *req,
return io_net_import_vec(req, iomsg, (struct iovec __user *)uiov,
msg->msg_iovlen, ddir);
}
-#endif
static int io_copy_msghdr_from_user(struct user_msghdr *msg,
struct user_msghdr __user *umsg)
@@ -330,7 +328,6 @@ static int io_sendmsg_copy_hdr(struct io_kiocb *req,
iomsg->msg.msg_name = &iomsg->addr;
iomsg->msg.msg_iter.nr_segs = 0;
-#ifdef CONFIG_COMPAT
if (io_is_compat(req->ctx)) {
struct compat_msghdr cmsg;
@@ -339,7 +336,6 @@ static int io_sendmsg_copy_hdr(struct io_kiocb *req,
sr->msg_control = iomsg->msg.msg_control_user;
return ret;
}
-#endif
ret = io_msg_copy_hdr(req, iomsg, &msg, ITER_SOURCE, NULL);
/* save msg_control as sys_sendmsg() overwrites it */
@@ -720,7 +716,6 @@ static int io_recvmsg_copy_hdr(struct io_kiocb *req,
iomsg->msg.msg_iter.nr_segs = 0;
if (io_is_compat(req->ctx)) {
-#ifdef CONFIG_COMPAT
struct compat_msghdr cmsg;
ret = io_compat_msg_copy_hdr(req, iomsg, &cmsg, ITER_DEST,
@@ -728,7 +723,6 @@ static int io_recvmsg_copy_hdr(struct io_kiocb *req,
memset(&msg, 0, sizeof(msg));
msg.msg_namelen = cmsg.msg_namelen;
msg.msg_controllen = cmsg.msg_controllen;
-#endif
} else {
ret = io_msg_copy_hdr(req, iomsg, &msg, ITER_DEST, &iomsg->uaddr);
}
--
2.39.5
next reply other threads:[~2025-02-27 13:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 13:20 Arnd Bergmann [this message]
2025-02-27 13:49 ` [PATCH] io_uring/net: fix build warning for !CONFIG_COMPAT Pavel Begunkov
2025-02-27 13:58 ` Arnd Bergmann
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=20250227132018.1111094-1-arnd@kernel.org \
--to=arnd@kernel.org \
--cc=arnd@arndb.de \
--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.