From: Dan Carpenter <dan.carpenter@oracle.com>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] [SCSI] aic94xx: silence a static checker warning
Date: Mon, 02 May 2016 08:34:58 +0000 [thread overview]
Message-ID: <20160502083458.GA19792@mwanda> (raw)
"ddb" is a number between 0-64. It can't ever be >= 0xFFFF. But the
static checker complains that since we're capping the upper bound, we
may as well cap the lower bound and disallow negatives as well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/scsi/aic94xx/aic94xx_dev.c b/drivers/scsi/aic94xx/aic94xx_dev.c
index 3307238..84eba3e 100644
--- a/drivers/scsi/aic94xx/aic94xx_dev.c
+++ b/drivers/scsi/aic94xx/aic94xx_dev.c
@@ -73,7 +73,7 @@ out:
static void asd_free_ddb(struct asd_ha_struct *asd_ha, int ddb)
{
- if (!ddb || ddb >= 0xFFFF)
+ if (ddb <= 0 || ddb >= 0xFFFF)
return;
asd_ddbsite_write_byte(asd_ha, ddb, DDB_TYPE, DDB_TYPE_UNUSED);
CLEAR_DDB(ddb, asd_ha);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] [SCSI] aic94xx: silence a static checker warning
Date: Mon, 2 May 2016 11:34:58 +0300 [thread overview]
Message-ID: <20160502083458.GA19792@mwanda> (raw)
"ddb" is a number between 0-64. It can't ever be >= 0xFFFF. But the
static checker complains that since we're capping the upper bound, we
may as well cap the lower bound and disallow negatives as well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/scsi/aic94xx/aic94xx_dev.c b/drivers/scsi/aic94xx/aic94xx_dev.c
index 3307238..84eba3e 100644
--- a/drivers/scsi/aic94xx/aic94xx_dev.c
+++ b/drivers/scsi/aic94xx/aic94xx_dev.c
@@ -73,7 +73,7 @@ out:
static void asd_free_ddb(struct asd_ha_struct *asd_ha, int ddb)
{
- if (!ddb || ddb >= 0xFFFF)
+ if (ddb <= 0 || ddb >= 0xFFFF)
return;
asd_ddbsite_write_byte(asd_ha, ddb, DDB_TYPE, DDB_TYPE_UNUSED);
CLEAR_DDB(ddb, asd_ha);
next reply other threads:[~2016-05-02 8:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 8:34 Dan Carpenter [this message]
2016-05-02 8:34 ` [patch] [SCSI] aic94xx: silence a static checker warning Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160502083458.GA19792@mwanda \
--to=dan.carpenter@oracle.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.