* [axboe-block:perf-wip 19/19] block/fops.c:584:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false
@ 2021-10-29 12:30 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-10-29 12:30 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3746 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git perf-wip
head: 03b560ccf75e145d2bdc374f3f6f670500a12c94
commit: 03b560ccf75e145d2bdc374f3f6f670500a12c94 [19/19] block: move direct_IO into our own read_iter handler
config: hexagon-buildonly-randconfig-r001-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git/commit/?id=03b560ccf75e145d2bdc374f3f6f670500a12c94
git remote add axboe-block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags axboe-block perf-wip
git checkout 03b560ccf75e145d2bdc374f3f6f670500a12c94
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> block/fops.c:584:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (iocb->ki_flags & IOCB_DIRECT) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:610:31: note: uninitialized use occurs here
ret = filemap_read(iocb, to, ret);
^~~
block/fops.c:584:2: note: remove the 'if' if its condition is always true
if (iocb->ki_flags & IOCB_DIRECT) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/fops.c:572:13: note: initialize the variable 'ret' to silence this warning
ssize_t ret;
^
= 0
1 error generated.
vim +584 block/fops.c
564
565 static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
566 {
567 struct block_device *bdev = iocb->ki_filp->private_data;
568 loff_t size = bdev->bd_nr_sectors << SECTOR_SHIFT;
569 size_t count = iov_iter_count(to);
570 loff_t pos = iocb->ki_pos;
571 size_t shorted = 0;
572 ssize_t ret;
573
574 if (unlikely(pos + count > size)) {
575 if (pos >= size)
576 return 0;
577 size -= pos;
578 if (count > size) {
579 shorted = count - size;
580 iov_iter_truncate(to, size);
581 }
582 }
583
> 584 if (iocb->ki_flags & IOCB_DIRECT) {
585 struct address_space *mapping = iocb->ki_filp->f_mapping;
586
587 if (iocb->ki_flags & IOCB_NOWAIT) {
588 if (filemap_range_needs_writeback(mapping, iocb->ki_pos,
589 iocb->ki_pos + count - 1))
590 return -EAGAIN;
591 } else {
592 ret = filemap_write_and_wait_range(mapping,
593 iocb->ki_pos,
594 iocb->ki_pos + count - 1);
595 if (ret < 0)
596 return ret;
597 }
598
599 file_accessed(iocb->ki_filp);
600
601 ret = blkdev_direct_IO(iocb, to);
602 if (ret >= 0) {
603 iocb->ki_pos += ret;
604 count -= ret;
605 }
606 if (ret < 0 || !count)
607 return ret;
608 }
609
610 ret = filemap_read(iocb, to, ret);
611
612 if (unlikely(shorted))
613 iov_iter_reexpand(to, iov_iter_count(to) + shorted);
614 return ret;
615 }
616
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31571 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-29 12:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 12:30 [axboe-block:perf-wip 19/19] block/fops.c:584:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false kernel test robot
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.