[PATCH] zram: we should always zero out err variable in recompress loop

From: Sergey Senozhatsky
Date: Thu Nov 10 2022 - 09:34:44 EST


Reported-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
---
drivers/block/zram/zram_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 171eccc2249d..9d33801e8ba8 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1891,7 +1891,7 @@ static ssize_t recompress_store(struct device *dev,

ret = len;
for (index = 0; index < nr_pages; index++) {
- int err;
+ int err = 0;

zram_slot_lock(zram, index);

--
2.38.1.431.g37b22c650d-goog