diff mbox series

qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done()

Message ID 20180808033952.21012-1-himanshu.madhani@cavium.com (mailing list archive)
State Accepted
Headers show
Series qla2xxx: Fix issue reported by static checker for qla2x00_els_dcmd2_sp_done() | expand

Commit Message

Madhani, Himanshu Aug. 8, 2018, 3:39 a.m. UTC
From: Quinn Tran <quinn.tran@cavium.com>

This patch fixes following Smatch complaint:

drivers/scsi/qla2xxx/qla_iocb.c:2647 qla2x00_els_dcmd2_sp_done()
error: we previously assumed 'e' could be null (see line 2631)

Fixes: 8777e4314d39 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_iocb.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Bart Van Assche Aug. 8, 2018, 3:10 p.m. UTC | #1
On Tue, 2018-08-07 at 20:39 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <quinn.tran@cavium.com>

To me this seems to be a real bug fix rather than a patch that only suppresses
a static checker complaint. If that is the case, please mention this in the 
patch subject.

Thanks,

Bart.
Madhani, Himanshu Aug. 8, 2018, 6:19 p.m. UTC | #2
Hi Bart, 

> On Aug 8, 2018, at 8:10 AM, Bart Van Assche <bart.vanassche@wdc.com> wrote:
> 
> External Email
> 
> On Tue, 2018-08-07 at 20:39 -0700, Himanshu Madhani wrote:
>> From: Quinn Tran <quinn.tran@cavium.com>
> 
> To me this seems to be a real bug fix rather than a patch that only suppresses
> a static checker complaint. If that is the case, please mention this in the
> patch subject.
> 

We have not run into this issue exposing this bug yet, until Static checker complained about it. 
But Yes, this is bug in the code where we should return after freeing sp.

> Thanks,
> 
> Bart.
> 

Thanks,
- Himanshu
Martin K. Petersen Aug. 9, 2018, 1:38 a.m. UTC | #3
Himanshu,

> This patch fixes following Smatch complaint:
>
> drivers/scsi/qla2xxx/qla_iocb.c:2647 qla2x00_els_dcmd2_sp_done()
> error: we previously assumed 'e' could be null (see line 2631)

Applied to 4.19/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 059f2c9dc192..213321295753 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -2642,6 +2642,7 @@  qla2x00_els_dcmd2_sp_done(void *ptr, int res)
 				    elsio->u.els_plogi.els_resp_pyld,
 				    elsio->u.els_plogi.els_resp_pyld_dma);
 			sp->free(sp);
+			return;
 		}
 		e->u.iosb.sp = sp;
 		qla2x00_post_work(vha, e);