From: sashiko-bot@kernel.org
To: "Shivendra Pratap" <shivendra.pratap@oss.qualcomm.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, devicetree@vger.kernel.org,
conor+dt@kernel.org
Subject: Re: [PATCH v22 02/13] power: reset: reboot-mode: Add support for 64 bit magic
Date: Thu, 14 May 2026 20:15:49 +0000 [thread overview]
Message-ID: <20260514201550.51090C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260514-arm-psci-system_reset2-vendor-reboots-v22-2-28a5bde07483@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Implicit integer underflow masks negative error codes returned by `device_property_count_u32()`.
--
commit 8477e879bf98a4cbb06ad4a10e04a5b704bf488c
Author: Shivendra Pratap <shivendra.pratap@oss.qualcomm.com>
power: reset: reboot-mode: Add support for 64 bit magic
The commit modifies the reboot-mode driver to support 64-bit magic values,
allowing up to two 32-bit arguments to be passed during a reboot sequence.
This is useful for firmware-based resets like ARM PSCI vendor-specific resets
that require multiple arguments. Existing reboot-mode drivers are updated
to handle the 64-bit magic.
> diff --git a/drivers/power/reset/reboot-mode.c b/drivers/power/reset/reboot-mode.c
> index 7a74f72a8313b..f1372dc700e48 100644
> --- a/drivers/power/reset/reboot-mode.c
> +++ b/drivers/power/reset/reboot-mode.c
[ ... ]
> @@ -175,16 +174,22 @@ int reboot_mode_register(struct reboot_mode_driver *reboot)
> struct property *prop;
> struct device_node *np = reboot->dev->of_node;
> size_t len = strlen(PREFIX);
> - u32 magic;
> + size_t count;
> + u32 magic[2];
> int ret;
>
> INIT_LIST_HEAD(&reboot->head);
>
> for_each_property_of_node(np, prop) {
> + memset(magic, 0, sizeof(magic));
> +
> if (strncmp(prop->name, PREFIX, len))
> continue;
>
> - if (device_property_read_u32(reboot->dev, prop->name, &magic)) {
> + count = device_property_count_u32(reboot->dev, prop->name);
Does this implicitly underflow count? device_property_count_u32() returns an
int, which can be a negative error code (like -EINVAL or -ENODATA) if the
property parsing fails. Assigning it to a size_t will wrap negative errors
into very large positive unsigned integers.
> +
> + if (!count || count > ARRAY_SIZE(magic) ||
> + device_property_read_u32_array(reboot->dev, prop->name, magic, count)) {
While count > ARRAY_SIZE(magic) will successfully catch the wrapped negative
error code because the large positive value exceeds 2, relying on unsigned
integer wraparound for error handling can be brittle.
Should count be declared as an int to explicitly check for negative error
codes returned from device_property_count_u32()?
> pr_debug("reboot mode %s without magic number\n", prop->name);
> continue;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260514-arm-psci-system_reset2-vendor-reboots-v22-0-28a5bde07483@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-05-14 20:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-14 14:25 [PATCH v22 00/13] Implement PSCI reboot mode driver for PSCI resets Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 01/13] power: reset: reboot-mode: Remove devres based allocations Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 02/13] power: reset: reboot-mode: Add support for 64 bit magic Shivendra Pratap
2026-05-14 20:15 ` sashiko-bot [this message]
2026-05-14 14:25 ` [PATCH v22 03/13] power: reset: reboot-mode: Add support for predefined reboot modes Shivendra Pratap
2026-05-14 21:09 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 04/13] firmware: psci: Introduce command-based resets Shivendra Pratap
2026-05-14 21:23 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 05/13] mfd: psci-mfd: Add PSCI MFD driver for cpuidle-psci-domain cell Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 06/13] dt-bindings: arm: Document reboot mode magic Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 07/13] power: reset: Add psci-reboot-mode driver Shivendra Pratap
2026-05-14 22:49 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 08/13] mfd: core: Add firmware-node support to MFD cells Shivendra Pratap
2026-05-14 23:19 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 09/13] mfd: psci-mfd: Add psci-reboot-mode child cell Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 10/13] arm64: dts: qcom: Add psci reboot-modes for kodiak boards Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 11/13] arm64: dts: qcom: Add psci reboot-modes for lemans boards Shivendra Pratap
2026-05-14 14:25 ` [PATCH v22 12/13] arm64: dts: qcom: Add psci reboot-modes for monaco boards Shivendra Pratap
2026-05-15 0:24 ` sashiko-bot
2026-05-14 14:25 ` [PATCH v22 13/13] arm64: dts: qcom: Add psci reboot-modes for talos boards Shivendra Pratap
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=20260514201550.51090C2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shivendra.pratap@oss.qualcomm.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.