drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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(-)
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);
--
2.47.2
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.
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
© 2016 - 2026 Red Hat, Inc.