[ammarfaizi2-block:dhowells/linux-fs/netfs-lib 14/24] fs/netfs/read_helper.c:979:14: warning: variable 'folio' is uninitialized when used here

From: kernel test robot
Date: Mon Jan 17 2022 - 16:48:54 EST


tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-lib
head: e450b62f32df4384c141a6a382811b3fe5723bad
commit: e6b340ed3634bb80396afb564c499eebdeff601f [14/24] netfs: Use a buffer in netfs_read_request and add pages to it
config: x86_64-randconfig-a001-20220117 (https://download.01.org/0day-ci/archive/20220118/202201180514.gVYTloyy-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5f782d25a742302d25ef3c8b84b54f7483c2deb9)
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/e6b340ed3634bb80396afb564c499eebdeff601f
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-lib
git checkout e6b340ed3634bb80396afb564c499eebdeff601f
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/netfs/

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

All warnings (new ones prefixed by >>):

>> fs/netfs/read_helper.c:979:14: warning: variable 'folio' is uninitialized when used here [-Wuninitialized]
folio_put(folio);
^~~~~
fs/netfs/read_helper.c:928:21: note: initialize the variable 'folio' to silence this warning
struct folio *folio;
^
= NULL
1 warning generated.


vim +/folio +979 fs/netfs/read_helper.c

943
944 ret = netfs_rreq_add_folios_to_buffer(rreq, want_index, have_index - 1,
945 gfp_mask);
946 if (ret < 0)
947 return ret;
948 have_folios += have_index - want_index;
949
950 ret = netfs_rreq_add_folios_to_buffer(rreq, have_index + have_folios,
951 want_index + want_folios - 1,
952 gfp_mask);
953 if (ret < 0)
954 return ret;
955
956 /* Transfer the folios proposed by the VM into the buffer and take refs
957 * on them. The locks will be dropped in netfs_rreq_unlock().
958 */
959 if (ractl) {
960 while ((folio = readahead_folio(ractl))) {
961 folio_get(folio);
962 if (folio == keep)
963 folio_get(folio);
964 ret = xa_insert_set_mark(&rreq->buffer,
965 folio_index(folio), folio,
966 XA_MARK_0, gfp_mask);
967 if (ret < 0) {
968 if (folio != keep)
969 folio_unlock(folio);
970 folio_put(folio);
971 return ret;
972 }
973 }
974 } else {
975 folio_get(keep);
976 ret = xa_insert_set_mark(&rreq->buffer, keep->index, keep,
977 XA_MARK_0, gfp_mask);
978 if (ret < 0) {
> 979 folio_put(folio);
980 return ret;
981 }
982 }
983 return 0;
984 }
985

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx