* [PATCH] scsi_debug: check for bigger value first
@ 2015-01-06 21:03 Andy Shevchenko
2015-02-23 18:02 ` Douglas Gilbert
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2015-01-06 21:03 UTC (permalink / raw)
To: Ewan D . Milne, Christoph Hellwig, linux-scsi; +Cc: Andy Shevchenko
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>
---
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 8bcf6ad..a34df1d 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -4850,10 +4850,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) {
--
1.8.3.101.g727a46b
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi_debug: check for bigger value first
2015-01-06 21:03 [PATCH] scsi_debug: check for bigger value first Andy Shevchenko
@ 2015-02-23 18:02 ` Douglas Gilbert
0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2015-02-23 18:02 UTC (permalink / raw)
To: Andy Shevchenko, Ewan D . Milne, Christoph Hellwig, linux-scsi
On 15-01-06 04:03 PM, Andy Shevchenko wrote:
> 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>
> ---
> 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 8bcf6ad..a34df1d 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -4850,10 +4850,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) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-23 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 21:03 [PATCH] scsi_debug: check for bigger value first Andy Shevchenko
2015-02-23 18:02 ` Douglas Gilbert
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.