提交 fa785f0a 编写于 作者: A Andy Shevchenko 提交者: 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: NAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: NDouglas Gilbert <dgilbert@interlog.com>
Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: NEwan Milne <emilne@redhat.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册