Re: [PATCH] fpga: dfl: fme: Return directly after a failed devm_kasprintf() call in fme_perf_pmu_register()

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

 



On Tue, Jan 30, 2024 at 06:03:12PM +0800, Xu Yilun wrote:
> On Sat, Jan 27, 2024 at 03:55:19PM +0100, Markus Elfring wrote:
> > From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> > Date: Sat, 27 Jan 2024 15:43:42 +0100

Sorry, something to fix.

Please shorten your shortlog to less than 75 chars.
Please refer to Documentation/process/submitting-patches.rst

> > 
> > The result from a call of the function “devm_kasprintf” was passed to
> > a subsequent function call without checking for a null pointer before
> > (according to a memory allocation failure).
> > This issue was detected by using the Coccinelle software.
> > 
> > Thus return directly after a failed devm_kasprintf() call.
> > 
> > Fixes: 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")

One more char of sha.

Please use checkpatch to verify.

Thanks,
Yilun

> > Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> 
> Acked-by: Xu Yilun <yilun.xu@xxxxxxxxx>
> 
> > ---
> >  drivers/fpga/dfl-fme-perf.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
> > index 7422d2bc6f37..db56d52411ef 100644
> > --- a/drivers/fpga/dfl-fme-perf.c
> > +++ b/drivers/fpga/dfl-fme-perf.c
> > @@ -925,6 +925,8 @@ static int fme_perf_pmu_register(struct platform_device *pdev,
> >  				PERF_PMU_CAP_NO_EXCLUDE;
> > 
> >  	name = devm_kasprintf(priv->dev, GFP_KERNEL, "dfl_fme%d", pdev->id);
> > +	if (!name)
> > +		return -ENOMEM;
> > 
> >  	ret = perf_pmu_register(pmu, name, -1);
> >  	if (ret)
> > --
> > 2.43.0
> > 
> > 
> 




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux