[SCSI] sd: Do not call do_div() with a 64-bit divisor
authorGeert Uytterhoeven <geert@linux-m68k.org>
Mon, 4 Nov 2013 09:21:05 +0000 (10:21 +0100)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 19 Dec 2013 15:39:03 +0000 (07:39 -0800)
do_div() is meant for divisions of 64-bit number by 32-bit numbers.
Passing 64-bit divisor types caused issues in the past on 32-bit platforms,
cfr. commit ea077b1b96e073eac5c3c5590529e964767fc5f7 ("m68k: Truncate base
in do_div()").

As scsi_device.sector_size is unsigned (int), factor should be unsigned
int, too.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/sd.c

index 35a785609364e375ea9caaa6c214b4b5a6364c5e..9846c6ab2aaa92eeab130a92fe4d7b8d539b624c 100644 (file)
@@ -1626,7 +1626,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
                end_lba <<= 1;
        } else {
                /* be careful ... don't want any overflows */
-               u64 factor = scmd->device->sector_size / 512;
+               unsigned int factor = scmd->device->sector_size / 512;
                do_div(start_lba, factor);
                do_div(end_lba, factor);
        }
This page took 0.026861 seconds and 5 git commands to generate.