diff mbox series

[1/7] qla2xxx: Correct the check for sscanf return value

Message ID 20200928055023.3950-2-njavali@marvell.com
State Superseded
Headers show
Series qla2xxx bug fixes | expand

Commit Message

Nilesh Javali Sept. 28, 2020, 5:50 a.m. UTC
From: Saurav Kashyap <skashyap@marvell.com>

Since the version string is modified sscanf returns 4 instead of 6.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_tmpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Himanshu Madhani Sept. 28, 2020, 8:50 p.m. UTC | #1
On 9/28/20 12:50 AM, Nilesh Javali wrote:
> From: Saurav Kashyap <skashyap@marvell.com>
> 
> Since the version string is modified sscanf returns 4 instead of 6.
> 
> Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
>   drivers/scsi/qla2xxx/qla_tmpl.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
> index 8dc82cfd38b2..591df89a4d13 100644
> --- a/drivers/scsi/qla2xxx/qla_tmpl.c
> +++ b/drivers/scsi/qla2xxx/qla_tmpl.c
> @@ -906,8 +906,8 @@ qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
>   	uint8_t v[] = { 0, 0, 0, 0, 0, 0 };
>   
>   	WARN_ON_ONCE(sscanf(qla2x00_version_str,
> -			    "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
> -			    v+0, v+1, v+2, v+3, v+4, v+5) != 6);
> +			    "%hhu.%hhu.%hhu.%hhu",
> +			    v + 0, v + 1, v + 2, v + 3) != 4);
>   
>   	tmp->driver_info[0] = cpu_to_le32(
>   		v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);
> 

Looks good.

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 8dc82cfd38b2..591df89a4d13 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -906,8 +906,8 @@  qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
 	uint8_t v[] = { 0, 0, 0, 0, 0, 0 };
 
 	WARN_ON_ONCE(sscanf(qla2x00_version_str,
-			    "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
-			    v+0, v+1, v+2, v+3, v+4, v+5) != 6);
+			    "%hhu.%hhu.%hhu.%hhu",
+			    v + 0, v + 1, v + 2, v + 3) != 4);
 
 	tmp->driver_info[0] = cpu_to_le32(
 		v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);