All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sander Speetjens" <sander.speetjens@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v6 2/3] firmware: raspberrypi: Register PMIC hwmon driver on Pi 5
Date: Tue, 01 Dec 2026 14:02:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-243444@kernel.org> (raw)
In-Reply-To: <20261201-hwmon-da9091-v6-2-3e08054ea066@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] firmware: raspberrypi: uninitialized packet in
  rpi_register_pmic_driver()
--

commit 5caf82471f51c9b3669743e9107b253030403d88
Author: Sander Speetjens <sander.speetjens@gmail.com>

firmware: raspberrypi: Register PMIC hwmon driver on Pi 5

This commit registers the raspberrypi-pmic-hwmon child platform device on
BCM2712-based Raspberry Pi 5 systems and unregisters it on driver removal.

> diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
> index d4f4753d39656..686bcc4af818d 100644
> --- a/drivers/firmware/raspberrypi.c
> +++ b/drivers/firmware/raspberrypi.c
[ ... ]
> @@ -249,6 +250,30 @@ static void rpi_register_clk_driver(struct device *dev, struct rpi_firmware *fw)
>  	fw->clk_dev = pdev;
>  }
>  
> +static void rpi_register_pmic_driver(struct device *dev, struct rpi_firmware *fw)
> +{
> +	struct platform_device *pdev;
> +	u32 packet;
> +	int ret;
> +
> +	/* Only present on Pi 5 (bcm2712) */
> +	if (!(of_machine_is_compatible("brcm,bcm2712") ||
> +	      of_machine_is_compatible("brcm,bcm2712-d0")))
> +		return;
> +
> +	ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_PMIC_ADC,
> +				    &packet, sizeof(packet));

[Severity: Medium]
Does rpi_register_pmic_driver() pass uninitialized stack memory in packet
to rpi_firmware_property()?

rpi_firmware_property() copies sizeof(packet) bytes from tag_data into the
DMA-coherent mailbox request buffer before sending the property call to
the VideoCore firmware.  Passing an uninitialized u32 sends 4 bytes of
kernel stack garbage as the RPI_FIRMWARE_GET_PMIC_ADC request payload,
which can also cause the firmware query to fail and skip registering
raspberrypi-pmic-hwmon.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-hwmon-da9091-v6-0-3e08054ea066@gmail.com?part=2

  parent reply	other threads:[~2026-12-01 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 13:49 [PATCH v6 0/3] hwmon: add Raspberry Pi 5 PMIC driver Sander Speetjens
2026-12-01 13:49 ` [PATCH v6 1/3] soc: bcm2835: raspberrypi-firmware: Add PMIC ADC property tag Sander Speetjens
2026-12-01 13:49 ` [PATCH v6 2/3] firmware: raspberrypi: Register PMIC hwmon driver on Pi 5 Sander Speetjens
2026-12-01 13:53   ` Stefan Wahren
2026-12-01 14:02   ` sashiko-bot [this message]
2026-12-01 13:49 ` [PATCH v6 3/3] hwmon: add Raspberry Pi PMIC driver Sander Speetjens
2026-12-01 13:58   ` Stefan Wahren
2026-12-01 17:23   ` Guenter Roeck
2026-12-01 14:02 ` [PATCH v6 0/3] hwmon: add Raspberry Pi 5 " sashiko-bot

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=sashiko-outbox-243444@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sander.speetjens@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.