Re: [PATCH V2 RESEND] scsi: lpfc: Fix a possible null pointer dereference

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

 



Hi Huai-Yuan,

> diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
> index b1c9107d3408..94d968a255ff 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -1904,6 +1904,8 @@ lpfc_xcvr_data_show(struct device *dev, struct device_attribute *attr,
>
>         /* Get transceiver information */
>         rdp_context = kmalloc(sizeof(*rdp_context), GFP_KERNEL);
> +       if (!rdp_context)
> +               goto out_free_rdp;

Understood that kfree(NULL) essentially translates to no-op, but I'd
prefer that we return len here instead of goto out_free_rdp because
there really is nothing to free if kmalloc failed.

Thanks,
Justin




[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