Commit fa785f0a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Martin K. Petersen

scsi_debug: check for bigger value first

Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.
Signed-off-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarEwan Milne <emilne@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 09e2b0b1
......@@ -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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment