[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABPRKS9s11TqdoYF3sxHsXAxSNwt0fK+=29amtK9XHAvb4xM_w@mail.gmail.com>
Date: Fri, 14 Jun 2024 09:25:55 -0700
From: Justin Tee <justintee8345@...il.com>
To: Huai-Yuan Liu <qq810974084@...il.com>
Cc: Justin Tee <justin.tee@...adcom.com>, james.smart@...adcom.com,
dick.kennedy@...adcom.com, James.Bottomley@...senpartnership.com,
martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 RESEND] scsi: lpfc: Fix a possible null pointer dereference
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
Powered by blists - more mailing lists