diff mbox series

scsi: qla2xxx: Fix a condition in qla2x00_find_all_fabric_devs()

Message ID 20200619143041.GD267142@mwanda (mailing list archive)
State Mainlined
Commit 1fc98aaf7f85fadcca57c4a86ef17e1940cad2d3
Headers show
Series scsi: qla2xxx: Fix a condition in qla2x00_find_all_fabric_devs() | expand

Commit Message

Dan Carpenter June 19, 2020, 2:30 p.m. UTC
This code doesn't make sense unless the correct "fcport" was found.

Fixes: 9dd9686b1419 ("scsi: qla2xxx: Add changes for devloss timeout in driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is from static analysis and review.  I'm not super familiar with
the code and I can't test it.  Please review it extra carefully.

 drivers/scsi/qla2xxx/qla_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shyam Sundar June 24, 2020, 5:59 p.m. UTC | #1
+1.

Reviewed-by: Shyam Sundar <ssundar@marvell.com>

> On Jun 19, 2020, at 7:30 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> This code doesn't make sense unless the correct "fcport" was found.
> 
> Fixes: 9dd9686b1419 ("scsi: qla2xxx: Add changes for devloss timeout in driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is from static analysis and review.  I'm not super familiar with
> the code and I can't test it.  Please review it extra carefully.
> 
> drivers/scsi/qla2xxx/qla_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 4576d3ae9937..2436a17f5cd9 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -5944,7 +5944,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
> 			break;
> 		}
> 
> -		if (NVME_TARGET(vha->hw, fcport)) {
> +		if (found && NVME_TARGET(vha->hw, fcport)) {
> 			if (fcport->disc_state == DSC_DELETE_PEND) {
> 				qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
> 				vha->fcport_count--;
> -- 
> 2.27.0
>
Himanshu Madhani June 25, 2020, 2:11 p.m. UTC | #2
> On Jun 19, 2020, at 9:30 AM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> This code doesn't make sense unless the correct "fcport" was found.
> 
> Fixes: 9dd9686b1419 ("scsi: qla2xxx: Add changes for devloss timeout in driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is from static analysis and review.  I'm not super familiar with
> the code and I can't test it.  Please review it extra carefully.
> 
> drivers/scsi/qla2xxx/qla_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 4576d3ae9937..2436a17f5cd9 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -5944,7 +5944,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
> 			break;
> 		}
> 
> -		if (NVME_TARGET(vha->hw, fcport)) {
> +		if (found && NVME_TARGET(vha->hw, fcport)) {
> 			if (fcport->disc_state == DSC_DELETE_PEND) {
> 				qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
> 				vha->fcport_count--;
> -- 
> 2.27.0
> 

Looks Good. 

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

--
Himanshu Madhani	Oracle Linux Engineering
Martin K. Petersen June 27, 2020, 3:09 a.m. UTC | #3
On Fri, 19 Jun 2020 17:30:41 +0300, Dan Carpenter wrote:

> This code doesn't make sense unless the correct "fcport" was found.

Applied to 5.8/scsi-fixes, thanks!

[1/1] scsi: qla2xxx: Fix a condition in qla2x00_find_all_fabric_devs()
      https://git.kernel.org/mkp/scsi/c/1fc98aaf7f85
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 4576d3ae9937..2436a17f5cd9 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -5944,7 +5944,7 @@  qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
 			break;
 		}
 
-		if (NVME_TARGET(vha->hw, fcport)) {
+		if (found && NVME_TARGET(vha->hw, fcport)) {
 			if (fcport->disc_state == DSC_DELETE_PEND) {
 				qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
 				vha->fcport_count--;