linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Insu Yun <wuninsu@gmail.com>
To: JBottomley@odin.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu,
	changwoo@gatech.edu, Insu Yun <wuninsu@gmail.com>
Subject: [PATCH] aic94xx: fix potential integer signedness error
Date: Mon, 18 Jan 2016 10:15:03 -0500	[thread overview]
Message-ID: <1453130103-10645-1-git-send-email-wuninsu@gmail.com> (raw)

In asd_turn_led and asd_control_led, phy_id's upper bound is checked.
However, since phy_id is signed integer type, it can be less than 0.
Since phy_id is unsigned variable, for safety, it is better to change
a type of phy_id into unsigned integer variable. 

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/scsi/aic94xx/aic94xx_hwi.c | 4 ++--
 drivers/scsi/aic94xx/aic94xx_hwi.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 9f636a3..f6ebc9b 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -1276,7 +1276,7 @@ int asd_post_escb_list(struct asd_ha_struct *asd_ha, struct asd_ascb *ascb,
  * @phy_id: the PHY id whose LED we want to manupulate
  * @op: 1 to turn on, 0 to turn off
  */
-void asd_turn_led(struct asd_ha_struct *asd_ha, int phy_id, int op)
+void asd_turn_led(struct asd_ha_struct *asd_ha, u32 phy_id, int op)
 {
 	if (phy_id < ASD_MAX_PHYS) {
 		u32 v = asd_read_reg_dword(asd_ha, LmCONTROL(phy_id));
@@ -1297,7 +1297,7 @@ void asd_turn_led(struct asd_ha_struct *asd_ha, int phy_id, int op)
  * First we output enable the LED, then we set the source
  * to be an external module.
  */
-void asd_control_led(struct asd_ha_struct *asd_ha, int phy_id, int op)
+void asd_control_led(struct asd_ha_struct *asd_ha, u32 phy_id, int op)
 {
 	if (phy_id < ASD_MAX_PHYS) {
 		u32 v;
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.h b/drivers/scsi/aic94xx/aic94xx_hwi.h
index 8c1c282..0a22dda 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.h
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.h
@@ -388,8 +388,8 @@ int  asd_post_escb_list(struct asd_ha_struct *asd_ha, struct asd_ascb *ascb,
 
 int  asd_init_post_escbs(struct asd_ha_struct *asd_ha);
 void asd_build_control_phy(struct asd_ascb *ascb, int phy_id, u8 subfunc);
-void asd_control_led(struct asd_ha_struct *asd_ha, int phy_id, int op);
-void asd_turn_led(struct asd_ha_struct *asd_ha, int phy_id, int op);
+void asd_control_led(struct asd_ha_struct *asd_ha, u32 phy_id, int op);
+void asd_turn_led(struct asd_ha_struct *asd_ha, u32 phy_id, int op);
 int  asd_enable_phys(struct asd_ha_struct *asd_ha, const u8 phy_mask);
 
 void asd_ascb_timedout(unsigned long data);
-- 
1.9.1


                 reply	other threads:[~2016-01-18 15:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1453130103-10645-1-git-send-email-wuninsu@gmail.com \
    --to=wuninsu@gmail.com \
    --cc=JBottomley@odin.com \
    --cc=changwoo@gatech.edu \
    --cc=insu@gatech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=taesoo@gatech.edu \
    --cc=yeongjin.jang@gatech.edu \
    /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 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).