From: Randy Dunlap <rdunlap@xxxxxxxxxxxx> With CONFIG_LBD=n, 'sz' (32 bits) can overflow when capacity is multiplied (even * 2), as seen in a report from Dale Blount on lkml. Also make sure that 'mb' will not overflow. Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxx> --- drivers/scsi/sd.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff -Naurp linux-2614-rc5/drivers/scsi/sd.c~scsi_disk_capacity linux-2614-rc5/drivers/scsi/sd.c --- linux-2614-rc5/drivers/scsi/sd.c~scsi_disk_capacity 2005-10-20 18:55:35.000000000 -0700 +++ linux-2614-rc5/drivers/scsi/sd.c 2005-10-20 20:44:44.000000000 -0700 @@ -49,6 +49,7 @@ #include <linux/blkpg.h> #include <linux/kref.h> #include <linux/delay.h> +#include <asm/div64.h> #include <asm/uaccess.h> #include <scsi/scsi.h> @@ -1253,16 +1254,16 @@ got_data: * Jacques Gelinas (Jacques@xxxxxxxxxxxxxx) */ int hard_sector = sector_size; - sector_t sz = sdkp->capacity * (hard_sector/256); + u64 sz = sdkp->capacity * (hard_sector/256); request_queue_t *queue = sdp->request_queue; - sector_t mb; + u64 mb; blk_queue_hardsect_size(queue, hard_sector); /* avoid 64-bit division on 32-bit platforms */ mb = sz >> 1; - sector_div(sz, 1250); + do_div(sz, 1250); mb -= sz - 974; - sector_div(mb, 1950); + do_div(mb, 1950); printk(KERN_NOTICE "SCSI device %s: " "%llu %d-byte hdwr sectors (%llu MB)\n", --- - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html