All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] scsi_debug: check for bigger value first
@ 2015-11-26 18:22 Andy Shevchenko
  2015-11-27  9:32 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2015-11-26 18:22 UTC (permalink / raw)
  To: linux-scsi, Douglas Gilbert, Martin K . Petersen,
	James E.J. Bottomley
  Cc: Andy Shevchenko

From: Andy Shevchenko <andy.shevchenko@gmail.com>

Even for signed types we have to check for bigger positive value first.
Otherwise it will be never happened.

Acked-by: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/scsi/scsi_debug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index dfcc45b..f773b34 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -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) {
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-30 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26 18:22 [PATCH v1 1/1] scsi_debug: check for bigger value first Andy Shevchenko
2015-11-27  9:32 ` Johannes Thumshirn
2015-11-30 13:55 ` Ewan Milne
2015-11-30 17:14 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.