Message ID | 1443749565-8438-1-git-send-email-joel@jms.id.au (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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); > ^ > > Check that length is not zero (and not less than zero, but it's > unsigned, so that will always be satisfied). > > Signed-off-by: Joel Stanley <joel@jms.id.au> > --- > v2: invert the check to lose the ! as suggested by Johannes > > 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..c6110cb 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; Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 7a6dbfb..c6110cb 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;
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); ^ Check that length is not zero (and not less than zero, but it's unsigned, so that will always be satisfied). Signed-off-by: Joel Stanley <joel@jms.id.au> --- v2: invert the check to lose the ! as suggested by Johannes drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)