* [axboe-block:for-6.15/io_uring 55/56] io_uring/net.c:719:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2025-02-27 0:12 kernel test robot
2025-02-27 10:07 ` Pavel Begunkov
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-02-27 0:12 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: llvm, oe-kbuild-all, Jens Axboe
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.15/io_uring
head: 7eb5bb749ed945ead6a089e18e1d1da74523ac9a
commit: 68525267875757520752ff1abbda0af58fc172b9 [55/56] io_uring/net: unify *mshot_prep calls with compat
config: um-randconfig-001-20250227 (https://download.01.org/0day-ci/archive/20250227/202502270853.xYltEB97-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250227/202502270853.xYltEB97-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502270853.xYltEB97-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> io_uring/net.c:719:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
719 | if (io_is_compat(req->ctx)) {
| ^~~~~~~~~~~~~~~~~~~~~~
io_uring/net.c:733:15: note: uninitialized use occurs here
733 | if (unlikely(ret))
| ^~~
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
io_uring/net.c:719:2: note: remove the 'if' if its condition is always false
719 | if (io_is_compat(req->ctx)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
720 | #ifdef CONFIG_COMPAT
| ~~~~~~~~~~~~~~~~~~~~
721 | struct compat_msghdr cmsg;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
722 |
723 | ret = io_compat_msg_copy_hdr(req, iomsg, &cmsg, ITER_DEST,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
724 | &iomsg->uaddr);
| ~~~~~~~~~~~~~~~
725 | memset(&msg, 0, sizeof(msg));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
726 | msg.msg_namelen = cmsg.msg_namelen;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
727 | msg.msg_controllen = cmsg.msg_controllen;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
728 | #endif
| ~~~~~~
729 | } else {
| ~~~~~~
io_uring/net.c:714:9: note: initialize the variable 'ret' to silence this warning
714 | int ret;
| ^
| = 0
1 warning generated.
vim +719 io_uring/net.c
c55978024d123d Jens Axboe 2024-02-27 709
f9ead18c10589a Jens Axboe 2022-05-25 710 static int io_recvmsg_copy_hdr(struct io_kiocb *req,
f9ead18c10589a Jens Axboe 2022-05-25 711 struct io_async_msghdr *iomsg)
f9ead18c10589a Jens Axboe 2022-05-25 712 {
7fa875b8e53c28 Dylan Yudaken 2022-07-14 713 struct user_msghdr msg;
f9ead18c10589a Jens Axboe 2022-05-25 714 int ret;
f9ead18c10589a Jens Axboe 2022-05-25 715
c55978024d123d Jens Axboe 2024-02-27 716 iomsg->msg.msg_name = &iomsg->addr;
c55978024d123d Jens Axboe 2024-02-27 717 iomsg->msg.msg_iter.nr_segs = 0;
f9ead18c10589a Jens Axboe 2022-05-25 718
91864064622b17 Pavel Begunkov 2025-02-24 @719 if (io_is_compat(req->ctx)) {
68525267875757 Pavel Begunkov 2025-02-26 720 #ifdef CONFIG_COMPAT
c55978024d123d Jens Axboe 2024-02-27 721 struct compat_msghdr cmsg;
72c531f8ef3052 Dylan Yudaken 2022-07-14 722
820c215726a57f Pavel Begunkov 2025-02-26 723 ret = io_compat_msg_copy_hdr(req, iomsg, &cmsg, ITER_DEST,
820c215726a57f Pavel Begunkov 2025-02-26 724 &iomsg->uaddr);
68525267875757 Pavel Begunkov 2025-02-26 725 memset(&msg, 0, sizeof(msg));
68525267875757 Pavel Begunkov 2025-02-26 726 msg.msg_namelen = cmsg.msg_namelen;
68525267875757 Pavel Begunkov 2025-02-26 727 msg.msg_controllen = cmsg.msg_controllen;
f9ead18c10589a Jens Axboe 2022-05-25 728 #endif
68525267875757 Pavel Begunkov 2025-02-26 729 } else {
820c215726a57f Pavel Begunkov 2025-02-26 730 ret = io_msg_copy_hdr(req, iomsg, &msg, ITER_DEST, &iomsg->uaddr);
68525267875757 Pavel Begunkov 2025-02-26 731 }
68525267875757 Pavel Begunkov 2025-02-26 732
c55978024d123d Jens Axboe 2024-02-27 733 if (unlikely(ret))
c55978024d123d Jens Axboe 2024-02-27 734 return ret;
c55978024d123d Jens Axboe 2024-02-27 735 return io_recvmsg_mshot_prep(req, iomsg, msg.msg_namelen,
c55978024d123d Jens Axboe 2024-02-27 736 msg.msg_controllen);
f9ead18c10589a Jens Axboe 2022-05-25 737 }
f9ead18c10589a Jens Axboe 2022-05-25 738
:::::: The code at line 719 was first introduced by commit
:::::: 91864064622b17e74f49fd42689a052eaac4f08e io_uring/net: use io_is_compat()
:::::: TO: Pavel Begunkov <asml.silence@gmail.com>
:::::: CC: Jens Axboe <axboe@kernel.dk>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [axboe-block:for-6.15/io_uring 55/56] io_uring/net.c:719:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
2025-02-27 0:12 [axboe-block:for-6.15/io_uring 55/56] io_uring/net.c:719:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
@ 2025-02-27 10:07 ` Pavel Begunkov
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2025-02-27 10:07 UTC (permalink / raw)
To: kernel test robot; +Cc: llvm, oe-kbuild-all, Jens Axboe
On 2/27/25 00:12, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-6.15/io_uring
> head: 7eb5bb749ed945ead6a089e18e1d1da74523ac9a
> commit: 68525267875757520752ff1abbda0af58fc172b9 [55/56] io_uring/net: unify *mshot_prep calls with compat
> config: um-randconfig-001-20250227 (https://download.01.org/0day-ci/archive/20250227/202502270853.xYltEB97-lkp@intel.com/config)
> compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250227/202502270853.xYltEB97-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202502270853.xYltEB97-lkp@intel.com/
Not a real problem, it's just the compiler (understandably) can't
derive that the block is only empty IFF io_is_compat() is a
constant false.
We can initialise the var and let the compiler optimise it to
silence the warning.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-27 10:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27 0:12 [axboe-block:for-6.15/io_uring 55/56] io_uring/net.c:719:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
2025-02-27 10:07 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox