All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] erofs: fix uninitialized variable i used in a while-loop
@ 2021-04-06 16:27 Colin King
  2021-04-06 23:54   ` Gao Xiang
  0 siblings, 1 reply; 7+ messages in thread
From: Colin King @ 2021-04-06 16:27 UTC (permalink / raw)
  To: Gao Xiang, Chao Yu, linux-erofs; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The while-loop iterates until src is non-null or i is 3, however, the
loop counter i is not intinitialied to zero, causing incorrect iteration
counts.  Fix this by initializing it to zero.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 1aa5f2e2feed ("erofs: support decompress big pcluster for lz4 backend")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/erofs/decompressor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c
index fe46a9c34923..8687ff81406b 100644
--- a/fs/erofs/decompressor.c
+++ b/fs/erofs/decompressor.c
@@ -154,6 +154,7 @@ static void *z_erofs_handle_inplace_io(struct z_erofs_decompress_req *rq,
 	}
 	kunmap_atomic(inpage);
 	might_sleep();
+	i = 0;
 	while (1) {
 		src = vm_map_ram(rq->in, nrpages_in, -1);
 		/* retry two more times (totally 3 times) */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-07  3:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 16:27 [PATCH][next] erofs: fix uninitialized variable i used in a while-loop Colin King
2021-04-06 23:54 ` Gao Xiang
2021-04-06 23:54   ` Gao Xiang
2021-04-07  3:38   ` Joe Perches
2021-04-07  3:38     ` Joe Perches
2021-04-07  3:51     ` Gao Xiang
2021-04-07  3:51       ` Gao Xiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.