Commit c69cb1d1 authored by Damien Le Moal's avatar Damien Le Moal Committed by Mike Snitzer

dm zoned: fix uninitialized pointer dereference

Make sure that the local variable rzone in dmz_do_reclaim() is always
initialized before being used for printing debug messages.

Fixes: f97809ae ("dm zoned: per-device reclaim")
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent b3a9e3b9
...@@ -377,6 +377,7 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) ...@@ -377,6 +377,7 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
dmz_metadata_label(zmd), zrc->dev_idx); dmz_metadata_label(zmd), zrc->dev_idx);
return -EBUSY; return -EBUSY;
} }
rzone = dzone;
start = jiffies; start = jiffies;
if (dmz_is_cache(dzone) || dmz_is_rnd(dzone)) { if (dmz_is_cache(dzone) || dmz_is_rnd(dzone)) {
...@@ -391,8 +392,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) ...@@ -391,8 +392,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
*/ */
ret = dmz_reclaim_rnd_data(zrc, dzone); ret = dmz_reclaim_rnd_data(zrc, dzone);
} }
rzone = dzone;
} else { } else {
struct dm_zone *bzone = dzone->bzone; struct dm_zone *bzone = dzone->bzone;
sector_t chunk_block = 0; sector_t chunk_block = 0;
...@@ -415,7 +414,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc) ...@@ -415,7 +414,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
* be later reclaimed. * be later reclaimed.
*/ */
ret = dmz_reclaim_seq_data(zrc, dzone); ret = dmz_reclaim_seq_data(zrc, dzone);
rzone = dzone;
} }
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment