summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNeilBrown <neil@brown.name>2019-01-06 21:06:25 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-23 20:10:09 +0100
commit7668d6e45f3a0f4caade465e2df969a1948fc3a4 (patch)
tree554d2242c0532dacb6ea8a2858a13c9f2f363403 /include/linux
parenta441fdaf8c3034436fb6045ee285e515628fc555 (diff)
downloadlinux-stable-7668d6e45f3a0f4caade465e2df969a1948fc3a4.tar.gz
linux-stable-7668d6e45f3a0f4caade465e2df969a1948fc3a4.tar.bz2
linux-stable-7668d6e45f3a0f4caade465e2df969a1948fc3a4.zip
dm: fix to_sector() for 32bit
commit 0bdb50c531f7377a9da80d3ce2d61f389c84cb30 upstream. A dm-raid array with devices larger than 4GB won't assemble on a 32 bit host since _check_data_dev_sectors() was added in 4.16. This is because to_sector() treats its argument as an "unsigned long" which is 32bits (4GB) on a 32bit host. Using "unsigned long long" is more correct. Kernels as early as 4.2 can have other problems due to to_sector() being used on the size of a device. Fixes: 0cf4503174c1 ("dm raid: add support for the MD RAID0 personality") cc: stable@vger.kernel.org (v4.2+) Reported-and-tested-by: Guillaume Perréal <gperreal@free.fr> Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device-mapper.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 6fb0808e87c8..bef2e36c01b4 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -601,7 +601,7 @@ do { \
*/
#define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
-static inline sector_t to_sector(unsigned long n)
+static inline sector_t to_sector(unsigned long long n)
{
return (n >> SECTOR_SHIFT);
}