From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Chenyuan Yang <chenyuan0y@gmail.com>
Cc: mturquette@baylibre.com, sboyd@kernel.org,
florian.fainelli@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, richardcochran@gmail.com,
dave.stevenson@raspberrypi.com, popcornmix@gmail.com,
mripard@kernel.org, u.kleine-koenig@baylibre.com,
nathan@kernel.org, linux-clk@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
zzjas98@gmail.com
Subject: Re: [PATCH] clk: bcm: rpi: Fix potential NULL pointer dereference
Date: Tue, 11 Feb 2025 07:06:11 +0100 [thread overview]
Message-ID: <Z6ro06dd81bGO77a@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20250211000917.1739835-1-chenyuan0y@gmail.com>
On Mon, Feb 10, 2025 at 06:09:17PM -0600, Chenyuan Yang wrote:
> The `init.name` could be NULL. Add missing check in the
> raspberrypi_clk_register().
> This is similar to commit 3027e7b15b02
> ("ice: Fix some null pointer dereference issues in ice_ptp.c").
> Besides, bcm2835_register_pll_divider() under the same directory also
> has a very similar check.
>
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> ---
> drivers/clk/bcm/clk-raspberrypi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
> index 0e1fe3759530..720acc10f8aa 100644
> --- a/drivers/clk/bcm/clk-raspberrypi.c
> +++ b/drivers/clk/bcm/clk-raspberrypi.c
> @@ -286,6 +286,8 @@ static struct clk_hw *raspberrypi_clk_register(struct raspberrypi_clk *rpi,
> init.name = devm_kasprintf(rpi->dev, GFP_KERNEL,
> "fw-clk-%s",
> rpi_firmware_clk_names[id]);
> + if (!init.name)
> + return ERR_PTR(-ENOMEM);
> init.ops = &raspberrypi_firmware_clk_ops;
> init.flags = CLK_GET_RATE_NOCACHE;
Thanks for the fix. There is a need for a fixes tag in case like that.
Please add it in commit message. Take a look here for example [1].
[1] https://lore.kernel.org/netdev/DM3PR11MB8736BC7EF3A66720427F3775ECF22@DM3PR11MB8736.namprd11.prod.outlook.com/T/#mbc8028620ecffb2f3a23c96130fe03708e679b25
Beside that:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> --
> 2.34.1
prev parent reply other threads:[~2025-02-11 6:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 0:09 [PATCH] clk: bcm: rpi: Fix potential NULL pointer dereference Chenyuan Yang
2025-02-11 4:08 ` Florian Fainelli
2025-02-11 6:06 ` Michal Swiatkowski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6ro06dd81bGO77a@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=chenyuan0y@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=florian.fainelli@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=popcornmix@gmail.com \
--cc=richardcochran@gmail.com \
--cc=sboyd@kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=zzjas98@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.