]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
scsi: do not call do_div() with a 64-bit divisor
authorGeert Uytterhoeven <geert@linux-m68k.org>
Tue, 5 Nov 2013 05:55:15 +0000 (16:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 5 Nov 2013 05:55:15 +0000 (16:55 +1100)
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 ea077b1b96e073eac5c ("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: Andrew Morton <akpm@linux-foundation.org>
drivers/scsi/sd.c

index 5693f6d7eddb8b20cd9b3e0374a4e73e60ab7aa2..d6645c70cceb0c7eb3124daddf72a7e902a1b022 100644 (file)
@@ -1607,7 +1607,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);
        }