lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEnQdOopYHSK_SVAaEjVDCq9Jk5xQCe02YZnKXnbNHcePC2O1A@mail.gmail.com>
Date: Thu, 24 Apr 2025 11:14:24 +0800
From: henry martin <bsdhenrymartin@...il.com>
To: mturquette@...libre.com, sboyd@...nel.org
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, 
	david@...hnology.com
Subject: Re: [PATCH v1] clk: davinci: Add NULL check in davinci_lpsc_clk_register()

Hi Michael, Stephen,

I wanted to follow up on my previous patch submission to check if there are any
additional feedback or changes you'd like me to address. If so, I’d be happy to
incorporate them and send a v2.

Regards,
Henry

Henry Martin <bsdhenrymartin@...il.com> 于2025年4月1日周二 21:13写道:
>
> devm_kasprintf() returns NULL when memory allocation fails. Currently,
> davinci_lpsc_clk_register() does not check for this case, which results
> in a NULL pointer dereference.
>
> Add NULL check after devm_kasprintf() to prevent this issue and ensuring
> no resources are left allocated.
>
> Fixes: c6ed4d734bc7 ("clk: davinci: New driver for davinci PSC clocks")
> Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
> ---
>  drivers/clk/davinci/psc.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/clk/davinci/psc.c b/drivers/clk/davinci/psc.c
> index b48322176c21..f3ee9397bb0c 100644
> --- a/drivers/clk/davinci/psc.c
> +++ b/drivers/clk/davinci/psc.c
> @@ -277,6 +277,11 @@ davinci_lpsc_clk_register(struct device *dev, const char *name,
>
>         lpsc->pm_domain.name = devm_kasprintf(dev, GFP_KERNEL, "%s: %s",
>                                               best_dev_name(dev), name);
> +       if (!lpsc->pm_domain.name) {
> +               clk_hw_unregister(&lpsc->hw);
> +               kfree(lpsc);
> +               return ERR_PTR(-ENOMEM);
> +       }
>         lpsc->pm_domain.attach_dev = davinci_psc_genpd_attach_dev;
>         lpsc->pm_domain.detach_dev = davinci_psc_genpd_detach_dev;
>         lpsc->pm_domain.flags = GENPD_FLAG_PM_CLK;
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ