scsi_debug: check for bigger value first
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Thu, 26 Nov 2015 18:22:50 +0000 (20:22 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 30 Nov 2015 17:12:19 +0000 (12:12 -0500)
Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/scsi_debug.c

index ec622ba9864acc793ae59961c5fb9b953d5e41c4..1bea1adc16a8f1b85cc28722146446ca2f309a50 100644 (file)
@@ -4846,10 +4846,10 @@ static int __init scsi_debug_init(void)
        /* play around with geometry, don't waste too much on track 0 */
        sdebug_heads = 8;
        sdebug_sectors_per = 32;
-       if (scsi_debug_dev_size_mb >= 16)
-               sdebug_heads = 32;
-       else if (scsi_debug_dev_size_mb >= 256)
+       if (scsi_debug_dev_size_mb >= 256)
                sdebug_heads = 64;
+       else if (scsi_debug_dev_size_mb >= 16)
+               sdebug_heads = 32;
        sdebug_cylinders_per = (unsigned long)sdebug_capacity /
                               (sdebug_sectors_per * sdebug_heads);
        if (sdebug_cylinders_per >= 1024) {