* [PATCH] be2iscsi: Fix bad WARN_ON
@ 2015-10-01 8:02 Joel Stanley
2015-10-01 8:31 ` Johannes Thumshirn
0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2015-10-01 8:02 UTC (permalink / raw)
To: jayamohan.kallickal, minh.tran, sony.john-n; +Cc: JBottomley, linux-scsi
GCC 5 helpfully warns us that the WARN_ON check may be buggy:
drivers/scsi/be2iscsi/be_main.c: In function ‘be_sgl_create_contiguous’:
drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only
applied to the left hand side of comparison [-Wlogical-not-parentheses]
WARN_ON(!length > 0);
^
Add the brackets that the check was was looking for.
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
drivers/scsi/be2iscsi/be_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..0b87abb 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
{
WARN_ON(!virtual_address);
WARN_ON(!physical_address);
- WARN_ON(!length > 0);
+ WARN_ON(!(length > 0));
WARN_ON(!sgl);
sgl->va = virtual_address;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] be2iscsi: Fix bad WARN_ON
2015-10-01 8:02 [PATCH] be2iscsi: Fix bad WARN_ON Joel Stanley
@ 2015-10-01 8:31 ` Johannes Thumshirn
2015-10-02 0:52 ` Joel Stanley
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Thumshirn @ 2015-10-01 8:31 UTC (permalink / raw)
To: Joel Stanley
Cc: jayamohan.kallickal, minh.tran, sony.john-n, JBottomley,
linux-scsi
Joel Stanley <joel@jms.id.au> writes:
> GCC 5 helpfully warns us that the WARN_ON check may be buggy:
>
> drivers/scsi/be2iscsi/be_main.c: In function ‘be_sgl_create_contiguous’:
> drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only
> applied to the left hand side of comparison [-Wlogical-not-parentheses]
> WARN_ON(!length > 0);
> ^
>
> Add the brackets that the check was was looking for.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> drivers/scsi/be2iscsi/be_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 7a6dbfb..0b87abb 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
> {
> WARN_ON(!virtual_address);
> WARN_ON(!physical_address);
> - WARN_ON(!length > 0);
> + WARN_ON(!(length > 0));
Why aren't you doing WARN_ON(length <= 0); it's much nicer to read IMHO
> WARN_ON(!sgl);
>
> sgl->va = virtual_address;
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] be2iscsi: Fix bad WARN_ON
2015-10-01 8:31 ` Johannes Thumshirn
@ 2015-10-02 0:52 ` Joel Stanley
2015-10-02 12:22 ` Tomas Henzl
0 siblings, 1 reply; 4+ messages in thread
From: Joel Stanley @ 2015-10-02 0:52 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: jayamohan.kallickal, minh.tran, sony.john-n, JBottomley,
linux-scsi
On Thu, Oct 1, 2015 at 6:01 PM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
>> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
>> index 7a6dbfb..0b87abb 100644
>> --- a/drivers/scsi/be2iscsi/be_main.c
>> +++ b/drivers/scsi/be2iscsi/be_main.c
>> @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
>> {
>> WARN_ON(!virtual_address);
>> WARN_ON(!physical_address);
>> - WARN_ON(!length > 0);
>> + WARN_ON(!(length > 0));
>
> Why aren't you doing WARN_ON(length <= 0); it's much nicer to read IMHO
Sure, I'll resend.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] be2iscsi: Fix bad WARN_ON
2015-10-02 0:52 ` Joel Stanley
@ 2015-10-02 12:22 ` Tomas Henzl
0 siblings, 0 replies; 4+ messages in thread
From: Tomas Henzl @ 2015-10-02 12:22 UTC (permalink / raw)
To: Joel Stanley, Johannes Thumshirn
Cc: jayamohan.kallickal, minh.tran, sony.john-n, JBottomley,
linux-scsi
On 2.10.2015 02:52, Joel Stanley wrote:
> On Thu, Oct 1, 2015 at 6:01 PM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
>>> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
>>> index 7a6dbfb..0b87abb 100644
>>> --- a/drivers/scsi/be2iscsi/be_main.c
>>> +++ b/drivers/scsi/be2iscsi/be_main.c
>>> @@ -3184,7 +3184,7 @@ be_sgl_create_contiguous(void *virtual_address,
>>> {
>>> WARN_ON(!virtual_address);
>>> WARN_ON(!physical_address);
>>> - WARN_ON(!length > 0);
>>> + WARN_ON(!(length > 0));
>> Why aren't you doing WARN_ON(length <= 0); it's much nicer to read IMHO
> Sure, I'll resend.
length is unsigned, so maybe just (!length) ?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-02 12:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 8:02 [PATCH] be2iscsi: Fix bad WARN_ON Joel Stanley
2015-10-01 8:31 ` Johannes Thumshirn
2015-10-02 0:52 ` Joel Stanley
2015-10-02 12:22 ` Tomas Henzl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).