[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_29819C31A7E71A71105124840B2855FD970A@qq.com>
Date: Mon, 13 Dec 2021 09:56:49 +0800
From: "Xiaoke Wang" <xkernel.wang@...mail.com>
To: "Bart Van Assche" <bvanassche@....org>,
"jejb" <jejb@...ux.ibm.com>,
"martin.petersen" <martin.petersen@...cle.com>
Cc: "linux-scsi" <linux-scsi@...r.kernel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
"alim.akhtar" <alim.akhtar@...sung.com>,
"avri.altman" <avri.altman@....com>
Subject: Re: [PATCH] scsi: ufs: ufshcd-pltfrm: check the return value of kstrdup()
On 12/12/21 22:32, Bart Van Assche wrote:
> Is xkernel the name of a person or the name of a robot? Patches should
> be signed by a person even if these have been generated by a robot.
>
> > + clki->name = kstrdup(name, GFP_KERNEL);
> > + if (!clki->name) {
> > + ret = -ENOMEM;
> > + devm_kfree(dev, clki);
> > + goto out;
> > + }
>
> Is the devm_kfree() call necessary? Is it useful?
Note: the last mail seems fail because of the html content.
Sorry about that, xkernel is my English name I named myself, my full
name in Chinese format is "Xiaoke Wang". Thank you for your
suggestion, I will consider using my official name in the future.
clki is allocated on above of kstrdup(), line 86-90, and if clki is NULL
will return -ENOMEM which is the same return value with the patch. So
I think clki should be freed to prevent potential memory leak:
> clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL);
> if (!clki) {
> ret = -ENOMEM;
> goto out;
> }
vreg is in similar case.
Powered by blists - more mailing lists