llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [axboe-block:io_uring-msg-ring.1 6/7] io_uring/msg_ring.c:95:6: warning: variable 'flags' is used uninitialized whenever 'if' condition is false
@ 2024-06-06 20:34 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-06-06 20:34 UTC (permalink / raw)
  To: Jens Axboe; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git io_uring-msg-ring.1
head:   0ffab2e0e86e525c59448ded8bac7bbf256e650f
commit: d11afec0fbe1eaf03077a755e2b9cb5386c22d19 [6/7] io_uring/msg_ring: improve handling of target CQE posting
config: s390-allnoconfig (https://download.01.org/0day-ci/archive/20240607/202406070408.EifgtOJu-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project d7d2d4f53fc79b4b58e8d8d08151b577c3699d4a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240607/202406070408.EifgtOJu-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/202406070408.EifgtOJu-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from io_uring/msg_ring.c:11:
   In file included from io_uring/io_uring.h:6:
   In file included from include/linux/resume_user_mode.h:8:
   In file included from include/linux/memcontrol.h:21:
   In file included from include/linux/mm.h:2253:
   include/linux/vmstat.h:514:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     514 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> io_uring/msg_ring.c:95:6: warning: variable 'flags' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      95 |         if (msg->flags & IORING_MSG_RING_FLAGS_PASS)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   io_uring/msg_ring.c:100:35: note: uninitialized use occurs here
     100 |         io_req_set_res(target, msg->len, flags);
         |                                          ^~~~~
   io_uring/msg_ring.c:95:2: note: remove the 'if' if its condition is always true
      95 |         if (msg->flags & IORING_MSG_RING_FLAGS_PASS)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      96 |                 flags = msg->cqe_flags;
   io_uring/msg_ring.c:86:11: note: initialize the variable 'flags' to silence this warning
      86 |         u32 flags;
         |                  ^
         |                   = 0
   2 warnings generated.


vim +95 io_uring/msg_ring.c

56d8e3180c065c Pavel Begunkov 2023-01-20   80  
d11afec0fbe1ea Jens Axboe     2024-03-28   81  static int io_msg_data_remote(struct io_kiocb *req)
6d043ee1164ca3 Pavel Begunkov 2022-12-07   82  {
6d043ee1164ca3 Pavel Begunkov 2022-12-07   83  	struct io_ring_ctx *target_ctx = req->file->private_data;
d11afec0fbe1ea Jens Axboe     2024-03-28   84  	struct io_msg *msg = io_kiocb_to_cmd(req, struct io_msg);
d11afec0fbe1ea Jens Axboe     2024-03-28   85  	struct io_kiocb *target;
d11afec0fbe1ea Jens Axboe     2024-03-28   86  	u32 flags;
6d043ee1164ca3 Pavel Begunkov 2022-12-07   87  
d11afec0fbe1ea Jens Axboe     2024-03-28   88  	BUILD_BUG_ON(sizeof_field(struct io_kiocb, cmd) <
d11afec0fbe1ea Jens Axboe     2024-03-28   89  			sizeof(struct io_overflow_cqe) + sizeof(struct io_uring_cqe));
d11afec0fbe1ea Jens Axboe     2024-03-28   90  
d11afec0fbe1ea Jens Axboe     2024-03-28   91  	target = kmem_cache_alloc(req_cachep, GFP_ATOMIC | __GFP_ZERO);
d11afec0fbe1ea Jens Axboe     2024-03-28   92  	if (!target)
d11afec0fbe1ea Jens Axboe     2024-03-28   93  		return -ENOMEM;
8572df941cbef2 Jens Axboe     2023-01-21   94  
8572df941cbef2 Jens Axboe     2023-01-21  @95  	if (msg->flags & IORING_MSG_RING_FLAGS_PASS)
8572df941cbef2 Jens Axboe     2023-01-21   96  		flags = msg->cqe_flags;
8572df941cbef2 Jens Axboe     2023-01-21   97  
d11afec0fbe1ea Jens Axboe     2024-03-28   98  	target->flags = REQ_F_NOCACHE;
d11afec0fbe1ea Jens Axboe     2024-03-28   99  	target->cqe.user_data = msg->user_data;
d11afec0fbe1ea Jens Axboe     2024-03-28  100  	io_req_set_res(target, msg->len, flags);
d11afec0fbe1ea Jens Axboe     2024-03-28  101  	target->ctx = target_ctx;
d11afec0fbe1ea Jens Axboe     2024-03-28  102  	target->io_task_work.func = io_req_task_complete;
d11afec0fbe1ea Jens Axboe     2024-03-28  103  	target->task = get_task_struct(READ_ONCE(target_ctx->submitter_task));
d11afec0fbe1ea Jens Axboe     2024-03-28  104  	io_req_task_work_add_remote(target, target_ctx, IOU_F_TWQ_LAZY_WAKE);
d11afec0fbe1ea Jens Axboe     2024-03-28  105  	return 0;
6d043ee1164ca3 Pavel Begunkov 2022-12-07  106  }
6d043ee1164ca3 Pavel Begunkov 2022-12-07  107  

:::::: The code at line 95 was first introduced by commit
:::::: 8572df941cbef2b295282535b013828e7df39471 io_uring/msg-ring: ensure flags passing works for task_work completions

:::::: TO: Jens Axboe <axboe@kernel.dk>
:::::: CC: Jens Axboe <axboe@kernel.dk>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-06 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 20:34 [axboe-block:io_uring-msg-ring.1 6/7] io_uring/msg_ring.c:95:6: warning: variable 'flags' is used uninitialized whenever 'if' condition is false kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).