diff mbox series

[next] zram: Fix uninitialized variable in zram_writeback_slots()

Message ID 02b8e156-e04f-4ab3-9322-b740c1f95284@stanley.mountain (mailing list archive)
State New
Headers show
Series [next] zram: Fix uninitialized variable in zram_writeback_slots() | expand

Commit Message

Dan Carpenter April 9, 2025, 10:58 a.m. UTC
The "ret" variable is only initialized on errors and not on success.
Initialize it to zero.

Fixes: 4529d2d13fd1 ("zram: modernize writeback interface")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/block/zram/zram_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergey Senozhatsky April 9, 2025, 11:10 a.m. UTC | #1
On (25/04/09 13:58), Dan Carpenter wrote:
> The "ret" variable is only initialized on errors and not on success.
> Initialize it to zero.

Thank you Dan.

> Fixes: 4529d2d13fd1 ("zram: modernize writeback interface")

This is still in mm-unstable, mind if we fold the fix in?
Or I can send a v4 with the fix applied.
Dan Carpenter April 9, 2025, 11:12 a.m. UTC | #2
On Wed, Apr 09, 2025 at 08:10:22PM +0900, Sergey Senozhatsky wrote:
> On (25/04/09 13:58), Dan Carpenter wrote:
> > The "ret" variable is only initialized on errors and not on success.
> > Initialize it to zero.
> 
> Thank you Dan.
> 
> > Fixes: 4529d2d13fd1 ("zram: modernize writeback interface")
> 
> This is still in mm-unstable, mind if we fold the fix in?
> Or I can send a v4 with the fix applied.

No, problem.  I understand how mm works.

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 2133488dbfd4..94e6e9b80bf0 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -741,7 +741,7 @@  static int zram_writeback_slots(struct zram *zram, struct zram_pp_ctl *ctl)
 	struct zram_pp_slot *pps;
 	struct bio_vec bio_vec;
 	struct bio bio;
-	int ret, err;
+	int ret = 0, err;
 	u32 index;
 
 	page = alloc_page(GFP_KERNEL);