Nikos Tsironis 81d5553d12 dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions()
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>
2020-03-27 14:42:51 -04:00
..
2019-11-12 19:12:07 -07:00
2019-09-16 10:18:01 -04:00
2019-11-12 19:12:07 -07:00
2019-09-04 09:39:22 -04:00
2019-08-23 10:13:12 -04:00
2019-11-20 10:35:31 -05:00
2019-09-12 09:32:31 -04:00
2019-03-12 10:15:18 -07:00
2019-12-09 10:36:44 -08:00