Hi Dan, > On Dec 14, 2017, at 2:02 AM, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > Hello himanshu.madhani@xxxxxxxxxx, > > This is a semi-automatic email about new static checker warnings. > > The patch 7867b98dceb7: "scsi: qla2xxx: Fix memory leak in > dual/target mode" from Dec 4, 2017, leads to the following Smatch > complaint: > > drivers/scsi/qla2xxx/qla_mid.c:586 qla25xx_delete_req_que() > error: we previously assumed 'req' could be null (see line 580) > > drivers/scsi/qla2xxx/qla_mid.c:602 qla25xx_delete_rsp_que() > error: we previously assumed 'rsp' could be null (see line 596) > > > drivers/scsi/qla2xxx/qla_mid.c > 579 > 580 if (req && vha->flags.qpairs_req_created) { > ^^^ > Check for NULL > > 581 req->options |= BIT_0; > 582 ret = qla25xx_init_req_que(vha, req); > 583 if (ret != QLA_SUCCESS) > 584 return QLA_FUNCTION_FAILED; > 585 } > 586 qla25xx_free_req_que(vha, req); > ^^^ > Unchecked dereference inside function. > > 587 > 588 return ret; > > [ snip ] > > 595 > 596 if (rsp && vha->flags.qpairs_rsp_created) { > ^^^ > 597 rsp->options |= BIT_0; > 598 ret = qla25xx_init_rsp_que(vha, rsp); > 599 if (ret != QLA_SUCCESS) > 600 return QLA_FUNCTION_FAILED; > 601 } > 602 qla25xx_free_rsp_que(vha, rsp); > ^^^ > 603 > 604 return ret; > > regards, > dan carpenter > > regards, > dan carpenter Thanks for reporting. I’ll send out patch with the corrections Thanks, - Himanshu