Re: [PATCH v2 3/8] qla2xxx: klocwork - avoid fcport pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jun 7, 2023, at 4:38 AM, Nilesh Javali <njavali@xxxxxxxxxxx> wrote:
> 
> Klocwork reported warning of null pointer may be dereferenced.
> The routine exits when sa_ctl is NULL and fcport is allocated after
> the exit call thus causing NULL fcport pointer to dereference at the
> time of exit.
> 
> To avoid fcport pointer dereference, exit the routine when
> sa_ctl is NULL.
> 
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Nilesh Javali <njavali@xxxxxxxxxxx>
> ---
> v2:
> - Exit the routine if sa_ctl is NULL.
> 
> drivers/scsi/qla2xxx/qla_edif.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edif.c
> index ec0e20255bd3..26e6b3e3af43 100644
> --- a/drivers/scsi/qla2xxx/qla_edif.c
> +++ b/drivers/scsi/qla2xxx/qla_edif.c
> @@ -2361,8 +2361,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
> if (!sa_ctl) {
> ql_dbg(ql_dbg_edif, vha, 0x70e6,
>    "sa_ctl allocation failed\n");
> - rval =  -ENOMEM;
> - goto done;
> + rval = -ENOMEM;
> + return rval;
> }
> 
> fcport = sa_ctl->fcport;
> -- 
> 2.23.1
> 

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

-- 
Himanshu Madhani Oracle Linux Engineering





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux