[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202210012124.DSLwfeGO-lkp@intel.com>
Date: Sat, 1 Oct 2022 21:42:30 +0800
From: kernel test robot <lkp@...el.com>
To: Bart Van Assche <bvanassche@....org>
Cc: llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org
Subject: [bvanassche:block-for-next 6/6]
drivers/block/null_blk/main.c:1276:13: warning: variable 'len' is
uninitialized when used here
tree: https://github.com/bvanassche/linux block-for-next
head: 481cfff256b6aa0e14e85749d199b26a17f26681
commit: 481cfff256b6aa0e14e85749d199b26a17f26681 [6/6] null_blk: Support configuring the maximum segment size
config: x86_64-randconfig-a012-20220926
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/bvanassche/linux/commit/481cfff256b6aa0e14e85749d199b26a17f26681
git remote add bvanassche https://github.com/bvanassche/linux
git fetch --no-tags bvanassche block-for-next
git checkout 481cfff256b6aa0e14e85749d199b26a17f26681
# 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=x86_64 SHELL=/bin/bash drivers/block/null_blk/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> drivers/block/null_blk/main.c:1276:13: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
sector += len >> SECTOR_SHIFT;
^~~
drivers/block/null_blk/main.c:1256:18: note: initialize the variable 'len' to silence this warning
unsigned int len, i;
^
= 0
1 warning generated.
vim +/len +1276 drivers/block/null_blk/main.c
1248
1249 static int null_handle_rq_sg(struct nullb_cmd *cmd)
1250 {
1251 struct request *rq = cmd->rq;
1252 struct nullb *nullb = cmd->nq->dev->nullb;
1253 sector_t sector = blk_rq_pos(rq);
1254 unsigned int nr_seg = blk_rq_nr_phys_segments(rq);
1255 struct scatterlist *sg, *sglist;
1256 unsigned int len, i;
1257 int err;
1258
1259 sglist = kcalloc(nr_seg, sizeof(*sglist), GFP_KERNEL);
1260 if (!sglist)
1261 return -ENOMEM;
1262
1263 sg_init_table(sglist, nr_seg);
1264 nr_seg = blk_rq_map_sg(rq->q, rq, sglist);
1265 WARN_ON_ONCE(nr_seg > blk_rq_nr_phys_segments(rq));
1266
1267 spin_lock_irq(&nullb->lock);
1268 for_each_sg(sglist, sg, nr_seg, i) {
1269 err = null_transfer(nullb, sg_page(sg), sg->length,
1270 sg->offset, op_is_write(req_op(rq)), sector,
1271 rq->cmd_flags & REQ_FUA);
1272 if (err) {
1273 spin_unlock_irq(&nullb->lock);
1274 goto out;
1275 }
> 1276 sector += len >> SECTOR_SHIFT;
1277 }
1278 spin_unlock_irq(&nullb->lock);
1279
1280 err = 0;
1281
1282 out:
1283 kfree(sglist);
1284 return err;
1285 }
1286
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (163071 bytes)
Powered by blists - more mailing lists