netfs: Ensure ret is always initialized in netfs_begin_read()
PATCH 1/1 netfs: Ensure ret is always initialized in netfs_begin_read()
Clang warns:
fs/netfs/io.c:630:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (sync) {
^~~~
fs/netfs/io.c:655:9: note: uninitialized use occurs here
return ret;
^~~There is only one instance of netfs_begin_read() where sync is false and its return value is not checked so just return 0 in this case, as there is no return code from another function call to propagate.
Fixes 33e1e5d53058 ("netfs: Add a function to consolidate beginning a read")
Reported-by kernel test robot <[email protected]>
Signed-off-by Nathan Chancellor <[email protected]>
--- fs/netfs/io.c | 1 + 1 file changed, 1 insertion(+)
fs/netfs/io.c +1 -0
@@ -651,6 +651,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)/* If we decrement nr_outstanding to 0, the ref belongs to us. */ if (atomic_dec_and_test (&rreq->nr_outstanding))netfs_rreq_assess (rreq, false); + ret =0 ; }return ret; }
base-commit: 2522c1b16116325f69670076d0c82024fbcc4e8d
Signature · 1 line
2.35.1