* [ammarfaizi2-block:axboe/linux-block/for-next 12/103] drivers/block/ublk_drv.c:831:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true
@ 2022-07-15 19:53 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-07-15 19:53 UTC (permalink / raw)
To: Ming Lei
Cc: llvm, kbuild-all, Ammar Faizi, GNU/Weeb Mailing List,
linux-kernel, Jens Axboe
tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/for-next
head: dc2ebf038c4a21786283c56d67e3cfd995275771
commit: 71f28f3136aff5890cd56de78abc673f8393cad9 [12/103] ublk_drv: add io_uring based userspace block driver
config: hexagon-buildonly-randconfig-r001-20220715 (https://download.01.org/0day-ci/archive/20220716/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 2da550140aa98cf6a3e96417c87f1e89e3a26047)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/ammarfaizi2/linux-block/commit/71f28f3136aff5890cd56de78abc673f8393cad9
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/for-next
git checkout 71f28f3136aff5890cd56de78abc673f8393cad9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/block/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> drivers/block/ublk_drv.c:831:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (tag >= ubq->q_depth)
^~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:831:2: note: remove the 'if' if its condition is always false
if (tag >= ubq->q_depth)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:828:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ubq->ubq_daemon && ubq->ubq_daemon != current)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:828:2: note: remove the 'if' if its condition is always false
if (ubq->ubq_daemon && ubq->ubq_daemon != current)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:825:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!ubq || ub_cmd->q_id != ubq->q_id)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:825:2: note: remove the 'if' if its condition is always false
if (!ubq || ub_cmd->q_id != ubq->q_id)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/block/ublk_drv.c:825:6: warning: variable 'io' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
if (!ubq || ub_cmd->q_id != ubq->q_id)
^~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:825:6: note: remove the '||' if its condition is always false
if (!ubq || ub_cmd->q_id != ubq->q_id)
^~~~~~~
drivers/block/ublk_drv.c:821:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ub_cmd->q_id >= ub->dev_info.nr_hw_queues)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:821:2: note: remove the 'if' if its condition is always false
if (ub_cmd->q_id >= ub->dev_info.nr_hw_queues)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:818:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!(issue_flags & IO_URING_F_SQE128))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:881:2: note: uninitialized use occurs here
io->flags &= ~UBLK_IO_FLAG_ACTIVE;
^~
drivers/block/ublk_drv.c:818:2: note: remove the 'if' if its condition is always false
if (!(issue_flags & IO_URING_F_SQE128))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/ublk_drv.c:809:20: note: initialize the variable 'io' to silence this warning
struct ublk_io *io;
^
= NULL
>> drivers/block/ublk_drv.c:1237:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!ub)
^~~
drivers/block/ublk_drv.c:1263:9: note: uninitialized use occurs here
return ret;
^~~
drivers/block/ublk_drv.c:1237:2: note: remove the 'if' if its condition is always false
if (!ub)
^~~~~~~~
drivers/block/ublk_drv.c:1234:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 0
7 warnings generated.
vim +831 drivers/block/ublk_drv.c
803
804 static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
805 {
806 struct ublksrv_io_cmd *ub_cmd = (struct ublksrv_io_cmd *)cmd->cmd;
807 struct ublk_device *ub = cmd->file->private_data;
808 struct ublk_queue *ubq;
809 struct ublk_io *io;
810 u32 cmd_op = cmd->cmd_op;
811 unsigned tag = ub_cmd->tag;
812 int ret = -EINVAL;
813
814 pr_devel("%s: received: cmd op %d queue %d tag %d result %d\n",
815 __func__, cmd->cmd_op, ub_cmd->q_id, tag,
816 ub_cmd->result);
817
818 if (!(issue_flags & IO_URING_F_SQE128))
819 goto out;
820
821 if (ub_cmd->q_id >= ub->dev_info.nr_hw_queues)
822 goto out;
823
824 ubq = ublk_get_queue(ub, ub_cmd->q_id);
> 825 if (!ubq || ub_cmd->q_id != ubq->q_id)
826 goto out;
827
828 if (ubq->ubq_daemon && ubq->ubq_daemon != current)
829 goto out;
830
> 831 if (tag >= ubq->q_depth)
832 goto out;
833
834 io = &ubq->ios[tag];
835
836 /* there is pending io cmd, something must be wrong */
837 if (io->flags & UBLK_IO_FLAG_ACTIVE) {
838 ret = -EBUSY;
839 goto out;
840 }
841
842 switch (cmd_op) {
843 case UBLK_IO_FETCH_REQ:
844 /* UBLK_IO_FETCH_REQ is only allowed before queue is setup */
845 if (ublk_queue_ready(ubq)) {
846 ret = -EBUSY;
847 goto out;
848 }
849 /*
850 * The io is being handled by server, so COMMIT_RQ is expected
851 * instead of FETCH_REQ
852 */
853 if (io->flags & UBLK_IO_FLAG_OWNED_BY_SRV)
854 goto out;
855 /* FETCH_RQ has to provide IO buffer */
856 if (!ub_cmd->addr)
857 goto out;
858 io->cmd = cmd;
859 io->flags |= UBLK_IO_FLAG_ACTIVE;
860 io->addr = ub_cmd->addr;
861
862 ublk_mark_io_ready(ub, ubq);
863 break;
864 case UBLK_IO_COMMIT_AND_FETCH_REQ:
865 /* FETCH_RQ has to provide IO buffer */
866 if (!ub_cmd->addr)
867 goto out;
868 if (!(io->flags & UBLK_IO_FLAG_OWNED_BY_SRV))
869 goto out;
870 io->addr = ub_cmd->addr;
871 io->flags |= UBLK_IO_FLAG_ACTIVE;
872 io->cmd = cmd;
873 ublk_commit_completion(ub, ub_cmd);
874 break;
875 default:
876 goto out;
877 }
878 return -EIOCBQUEUED;
879
880 out:
881 io->flags &= ~UBLK_IO_FLAG_ACTIVE;
882 io_uring_cmd_done(cmd, ret, 0);
883 pr_devel("%s: complete: cmd op %d, tag %d ret %x io_flags %x\n",
884 __func__, cmd_op, tag, ret, io->flags);
885 return -EIOCBQUEUED;
886 }
887
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-15 19:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15 19:53 [ammarfaizi2-block:axboe/linux-block/for-next 12/103] drivers/block/ublk_drv.c:831:6: warning: variable 'io' is used uninitialized whenever 'if' condition is true 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