Re: [PATCH] scsi: ufs: ufshcd-pltfrm: check the return value of kstrdup()

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

 



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.




[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