public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qlogicpti: add missing parentheses
@ 2009-11-03 23:38 Roel Kluin
  2009-11-03 23:51 ` James Bottomley
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Kluin @ 2009-11-03 23:38 UTC (permalink / raw)
  To: James E.J. Bottomley, linux-scsi, Andrew Morton, LKML

`+' has a higher precedence than `?' so the condition always
evaluates to true and this is preprocessed to `7*((ql) - 1)'

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 drivers/scsi/qlogicpti.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This one must be right, I think.

QLOGICPTI_MAX_SG is used here:

drivers/scsi/qlogicpti.c:964:   host->sg_tablesize = QLOGICPTI_MAX_SG(num_free);
drivers/scsi/qlogicpti.c:1288:  .sg_tablesize           = QLOGICPTI_MAX_SG(QLOGICPTI_REQ_QUEUE_LEN),

Thanks, Roel

diff --git a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h
index 9c053bb..e3c74d1 100644
--- a/drivers/scsi/qlogicpti.h
+++ b/drivers/scsi/qlogicpti.h
@@ -43,7 +43,7 @@
  * determined for each queue request anew.
  */
 #define QLOGICPTI_REQ_QUEUE_LEN	255	/* must be power of two - 1 */
-#define QLOGICPTI_MAX_SG(ql)	(4 + ((ql) > 0) ? 7*((ql) - 1) : 0)
+#define QLOGICPTI_MAX_SG(ql)	(4 + (((ql) > 0) ? 7*((ql) - 1) : 0))
 
 /* mailbox command complete status codes */
 #define MBOX_COMMAND_COMPLETE		0x4000

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

* Re: [PATCH] qlogicpti: add missing parentheses
  2009-11-03 23:38 [PATCH] qlogicpti: add missing parentheses Roel Kluin
@ 2009-11-03 23:51 ` James Bottomley
  2009-11-04  0:19   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2009-11-03 23:51 UTC (permalink / raw)
  To: Roel Kluin; +Cc: linux-scsi, Andrew Morton, LKML

On Wed, 2009-11-04 at 00:38 +0100, Roel Kluin wrote:
> `+' has a higher precedence than `?' so the condition always
> evaluates to true and this is preprocessed to `7*((ql) - 1)'
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  drivers/scsi/qlogicpti.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> This one must be right, I think.

It looks plausible ... but it will increase the mailbox segment length
by 4 ... someone needs to verify that this increase will actually work
and won't run off the end of the mailbox table.

James



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

* Re: [PATCH] qlogicpti: add missing parentheses
  2009-11-03 23:51 ` James Bottomley
@ 2009-11-04  0:19   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-11-04  0:19 UTC (permalink / raw)
  To: James.Bottomley; +Cc: roel.kluin, linux-scsi, akpm, linux-kernel

From: James Bottomley <James.Bottomley@suse.de>
Date: Tue, 03 Nov 2009 17:51:49 -0600

> On Wed, 2009-11-04 at 00:38 +0100, Roel Kluin wrote:
>> `+' has a higher precedence than `?' so the condition always
>> evaluates to true and this is preprocessed to `7*((ql) - 1)'
>> 
>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>> ---
>>  drivers/scsi/qlogicpti.h |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> This one must be right, I think.
> 
> It looks plausible ... but it will increase the mailbox segment length
> by 4 ... someone needs to verify that this increase will actually work
> and won't run off the end of the mailbox table.

It should be fine, good find Roel.

Acked-by: David S. Miller <davem@davemloft.net>

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

end of thread, other threads:[~2009-11-04  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03 23:38 [PATCH] qlogicpti: add missing parentheses Roel Kluin
2009-11-03 23:51 ` James Bottomley
2009-11-04  0:19   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox