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

From: kernel test robot
Date: Mon Jan 17 2022 - 18:51:01 EST


tree: https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-lib
head: e450b62f32df4384c141a6a382811b3fe5723bad
commit: 814cca7df840c441b1ac007bcb3eb8bfaeacb13f [21/24] cifs: Support fscache rewrite
config: arm-s3c2410_defconfig (https://download.01.org/0day-ci/archive/20220118/202201180713.iy4mum5Q-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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/ammarfaizi2/linux-block/commit/814cca7df840c441b1ac007bcb3eb8bfaeacb13f
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-lib
git checkout 814cca7df840c441b1ac007bcb3eb8bfaeacb13f
# 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=arm 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:971:14: warning: variable 'folio' is uninitialized when used here [-Wuninitialized]
folio_put(folio);
^~~~~
fs/netfs/read_helper.c:920:21: note: initialize the variable 'folio' to silence this warning
struct folio *folio;
^
= NULL
fs/netfs/read_helper.c:1267:7: error: implicit declaration of function 'netfs_is_cache_enabled' [-Werror,-Wimplicit-function-declaration]
if (!netfs_is_cache_enabled(ctx) &&
^
1 warning and 1 error generated.


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

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

:::::: The code at line 971 was first introduced by commit
:::::: e6b340ed3634bb80396afb564c499eebdeff601f netfs: Use a buffer in netfs_read_request and add pages to it

:::::: TO: David Howells <dhowells@xxxxxxxxxx>
:::::: CC: David Howells <dhowells@xxxxxxxxxx>

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