diff mbox series

scsi: scsi_dh_alua: signedness bug in alua_rtpg()

Message ID YLjMEAFNxOas1mIp@mwanda (mailing list archive)
State Accepted
Headers show
Series scsi: scsi_dh_alua: signedness bug in alua_rtpg() | expand

Commit Message

Dan Carpenter June 3, 2021, 12:33 p.m. UTC
The "retval" variable needs to be signed for the error handling to work.

Fixes: 7e26e3ea0287 ("scsi: scsi_dh_alua: Check for negative result value")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin Wilck June 4, 2021, 1:03 p.m. UTC | #1
On Do, 2021-06-03 at 15:33 +0300, Dan Carpenter wrote:
> The "retval" variable needs to be signed for the error handling to
> work.
> 
> Fixes: 7e26e3ea0287 ("scsi: scsi_dh_alua: Check for negative result
> value")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Martin Wilck <mwilck@suse.com>

> ---
>  drivers/scsi/device_handler/scsi_dh_alua.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c
> b/drivers/scsi/device_handler/scsi_dh_alua.c
> index 7baee18ebd03..37d06f993b76 100644
> --- a/drivers/scsi/device_handler/scsi_dh_alua.c
> +++ b/drivers/scsi/device_handler/scsi_dh_alua.c
> @@ -518,7 +518,8 @@ static int alua_rtpg(struct scsi_device *sdev,
> struct alua_port_group *pg)
>         int len, k, off, bufflen = ALUA_RTPG_SIZE;
>         int group_id_old, state_old, pref_old, valid_states_old;
>         unsigned char *desc, *buff;
> -       unsigned err, retval;
> +       unsigned err;
> +       int retval;
>         unsigned int tpg_desc_tbl_off;
>         unsigned char orig_transition_tmo;
>         unsigned long flags;
Martin K. Petersen June 8, 2021, 1:48 a.m. UTC | #2
Dan,

> The "retval" variable needs to be signed for the error handling to work.

Applied to 5.14/scsi-staging, thanks!
Martin K. Petersen June 16, 2021, 3:48 a.m. UTC | #3
On Thu, 3 Jun 2021 15:33:20 +0300, Dan Carpenter wrote:

> The "retval" variable needs to be signed for the error handling to work.

Applied to 5.14/scsi-queue, thanks!

[1/1] scsi: scsi_dh_alua: signedness bug in alua_rtpg()
      https://git.kernel.org/mkp/scsi/c/80927822e8b6
diff mbox series

Patch

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 7baee18ebd03..37d06f993b76 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -518,7 +518,8 @@  static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
 	int len, k, off, bufflen = ALUA_RTPG_SIZE;
 	int group_id_old, state_old, pref_old, valid_states_old;
 	unsigned char *desc, *buff;
-	unsigned err, retval;
+	unsigned err;
+	int retval;
 	unsigned int tpg_desc_tbl_off;
 	unsigned char orig_transition_tmo;
 	unsigned long flags;