From: H. Peter Anvin Date: Tue, 14 Oct 2008 18:34:20 +0000 (-0700) Subject: [SCSI] sd: fix computation of the full size of the device X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=520a2c2741747062e75f91cd0faddb564fbc64d2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [SCSI] sd: fix computation of the full size of the device When computing the full size of the device, we need to cast sdkp->capacity before shifting, since in some configurations sector_t can be a 32-bit number. Also, change ffz(~x) to the more idiomatic ilog2(x). Signed-off-by: H. Peter Anvin Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7e22aa7b8b8a..7ba70bef8b5d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1436,7 +1436,7 @@ got_data: { char cap_str_2[10], cap_str_10[10]; - u64 sz = sdkp->capacity << ffz(~sector_size); + u64 sz = (u64)sdkp->capacity << ilog2(sector_size); string_get_size(sz, STRING_UNITS_2, cap_str_2, sizeof(cap_str_2));