[xiang:erofs/advancedpcl 16/16] fs/erofs/zdata.c:896:12: warning: variable 'len' is uninitialized when used here

From: kernel test robot
Date: Thu Jul 14 2022 - 04:50:14 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git erofs/advancedpcl
head: 0889e3f1d4cc1d9cb08d961107c5e810c47ecfd0
commit: 0889e3f1d4cc1d9cb08d961107c5e810c47ecfd0 [16/16] erofs: introduce multi-reference pclusters (fully-referenced)
config: x86_64-randconfig-a005 (https://download.01.org/0day-ci/archive/20220714/202207141642.UPeaIPx7-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e61b9c556267086ef9b743a0b57df302eef831b)
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/xiang/linux.git/commit/?id=0889e3f1d4cc1d9cb08d961107c5e810c47ecfd0
git remote add xiang https://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git
git fetch --no-tags xiang erofs/advancedpcl
git checkout 0889e3f1d4cc1d9cb08d961107c5e810c47ecfd0
# 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 fs/erofs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/erofs/zdata.c:896:12: warning: variable 'len' is uninitialized when used here [-Wuninitialized]
cur += len;
^~~
fs/erofs/zdata.c:887:32: note: initialize the variable 'len' to silence this warning
unsigned int pgnr, scur, len;
^
= 0
1 warning generated.


vim +/len +896 fs/erofs/zdata.c

869
870 static void z_erofs_fill_other_copies(struct z_erofs_decompress_backend *be,
871 int err)
872 {
873 unsigned int off0 = be->pcl->pageofs_out;
874 struct list_head *p, *n;
875
876 list_for_each_safe(p, n, &be->decompressed_secondary_bvecs) {
877 struct z_erofs_bvec_item *bvi;
878 unsigned int end, cur;
879 void *dst, *src;
880
881 bvi = container_of(p, struct z_erofs_bvec_item, list);
882 cur = bvi->bvec.offset < 0 ? -bvi->bvec.offset : 0;
883 end = min_t(unsigned int, be->pcl->length - bvi->bvec.offset,
884 bvi->bvec.end);
885 dst = kmap_local_page(bvi->bvec.page);
886 while (cur < end) {
887 unsigned int pgnr, scur, len;
888
889 pgnr = (bvi->bvec.offset + cur + off0) >> PAGE_SHIFT;
890 DBG_BUGON(pgnr >= be->nr_pages);
891
892 scur = bvi->bvec.offset + cur -
893 ((pgnr << PAGE_SHIFT) - off0);
894 if (!be->decompressed_pages[pgnr]) {
895 err = -EFSCORRUPTED;
> 896 cur += len;
897 continue;
898 }
899 src = kmap_local_page(be->decompressed_pages[pgnr]);
900 len = min_t(unsigned int, end - cur, PAGE_SIZE - scur);
901 memcpy(dst + cur, src + scur, len);
902 kunmap_local(src);
903 cur += len;
904 }
905 kunmap_local(dst);
906 if (err)
907 z_erofs_page_mark_eio(bvi->bvec.page);
908 z_erofs_onlinepage_endio(bvi->bvec.page);
909 list_del(p);
910 kfree(bvi);
911 }
912 }
913

--
0-DAY CI Kernel Test Service
https://01.org/lkp