提交 c69cb1d1 编写于 作者: D Damien Le Moal 提交者: 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: NDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: NHannes Reinecke <hare@suse.de>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册