All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Jens Axboe <axboe@kernel.dk>
Subject: [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
Date: Thu, 27 Feb 2025 08:12:16 +0800	[thread overview]
Message-ID: <202502270853.xYltEB97-lkp@intel.com> (raw)

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

             reply	other threads:[~2025-02-27  0:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27  0:12 kernel test robot [this message]
2025-02-27 10:07 ` [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 Pavel Begunkov

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=202502270853.xYltEB97-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.