diff options
author | Nikos Tsironis <ntsironis@arrikto.com> | 2020-03-27 17:01:11 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-04-17 17:13:39 +0300 |
commit | 54aabddcf0b7e0cf51cbf80c1b9ee03e2723f7d2 (patch) | |
tree | 9b1aa064998f11a95df3062747ae24e05630b185 /lib | |
parent | 6709d665259a678200af6fb7ce9b95a3e3aae74f (diff) | |
download | linux-54aabddcf0b7e0cf51cbf80c1b9ee03e2723f7d2.tar.xz |
dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions()
commit 81d5553d1288c2ec0390f02f84d71ca0f0f9f137 upstream.
dm_clone_nr_of_hydrated_regions() returns the number of regions that
have been hydrated so far. In order to do so it employs bitmap_weight().
Until now, the return type of dm_clone_nr_of_hydrated_regions() was
unsigned long.
Because bitmap_weight() returns an int, in case BITS_PER_LONG == 64 and
the return value of bitmap_weight() is 2^31 (the maximum allowed number
of regions for a device), the result is sign extended from 32 bits to 64
bits and an incorrect value is displayed, in the status output of
dm-clone, as the number of hydrated regions.
Fix this by having dm_clone_nr_of_hydrated_regions() return an unsigned
int.
Fixes: 7431b7835f55 ("dm: add clone target")
Cc: stable@vger.kernel.org # v5.4+
Signed-off-by: Nikos Tsironis <ntsironis@arrikto.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions