diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-10-14 20:34:20 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-23 18:42:20 +0200 |
commit | 520a2c2741747062e75f91cd0faddb564fbc64d2 (patch) | |
tree | ee432a78dd07631a4df63abe4ae2958d2c18607e /drivers/scsi/sd.c | |
parent | [SCSI] lib: string_get_size(): don't hang on zero; no decimals on exact (diff) | |
download | linux-520a2c2741747062e75f91cd0faddb564fbc64d2.tar.xz linux-520a2c2741747062e75f91cd0faddb564fbc64d2.zip |
[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 <hpa@zytor.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 2 |
1 files changed, 1 insertions, 1 deletions
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)); |