Skip to content

Commit

Permalink
dm zoned: fix uninitialized pointer dereference
Browse files Browse the repository at this point in the history
Make sure that the local variable rzone in dmz_do_reclaim() is always
initialized before being used for printing debug messages.

Fixes: f97809a ("dm zoned: per-device reclaim")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Damien Le Moal authored and Mike Snitzer committed Jun 17, 2020
1 parent b3a9e3b commit c69cb1d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/md/dm-zoned-reclaim.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
dmz_metadata_label(zmd), zrc->dev_idx);
return -EBUSY;
}
rzone = dzone;

start = jiffies;
if (dmz_is_cache(dzone) || dmz_is_rnd(dzone)) {
Expand All @@ -391,8 +392,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
*/
ret = dmz_reclaim_rnd_data(zrc, dzone);
}
rzone = dzone;

} else {
struct dm_zone *bzone = dzone->bzone;
sector_t chunk_block = 0;
Expand All @@ -415,7 +414,6 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)
* be later reclaimed.
*/
ret = dmz_reclaim_seq_data(zrc, dzone);
rzone = dzone;
}
}
out:
Expand Down

0 comments on commit c69cb1d

Please sign in to comment.