[PATCH][next] netfs: fix uninitilalized value in ret being returned

From: Colin Ian King
Date: Thu Mar 03 2022 - 18:56:54 EST


In the case where sync is not true the variable ret not being
set and a garbage value is being returned. Fix this by ensuring
ret is initialized to 0.

Fixes: c19a5d31b470 ("netfs: Add a function to consolidate beginning a read")
Signed-off-by: Colin Ian King <colin.i.king@xxxxxxxxx>
---
fs/netfs/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/netfs/io.c b/fs/netfs/io.c
index 3db9356eb7c2..05fbe6665508 100644
--- a/fs/netfs/io.c
+++ b/fs/netfs/io.c
@@ -601,7 +601,7 @@ static bool netfs_rreq_submit_slice(struct netfs_io_request *rreq,
int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
{
unsigned int debug_index = 0;
- int ret;
+ int ret = 0;

_enter("R=%x %llx-%llx",
rreq->debug_id, rreq->start, rreq->start + rreq->len - 1);
--
2.34.1