From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 10/14] mfd: lm3533: Set DMA mask
Date: Sat, 06 Jun 2026 05:08:38 +0000 [thread overview]
Message-ID: <20260606050839.1278C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260606045738.21050-11-clamor95@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but an out-of-bounds array write occurs in `lm3533_device_init` when a child node contains multiple matching compatible strings.
--
commit 5fa77e39c45bca237d41fbd7e2b8b8b97be664ec
Author: Svyatoslav Ryhel <clamor95@gmail.com>
mfd: lm3533: Set DMA mask
This commit sets the DMA mask to zero to prevent a warning in dmesg about
the DMA mask not being set for the platform device. It applies to both
the coherent and regular DMA mask, as neither the core nor the cells
utilize DMA.
> diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
> index 500cec3ccebad..5d17da1d998b5 100644
> --- a/drivers/mfd/lm3533-core.c
> +++ b/drivers/mfd/lm3533-core.c
[ ... ]
> @@ -489,6 +489,10 @@ static int lm3533_i2c_probe(struct i2c_client *i2c)
> LM3533_BOOST_FREQ_MAX);
> lm3533->boost_freq = lm3533->boost_freq / (500 * KILO) - 1;
>
> + /* LM3533 and child devices do not use DMA */
> + i2c->dev.coherent_dma_mask = 0;
> + i2c->dev.dma_mask = &i2c->dev.coherent_dma_mask;
> +
> return lm3533_device_init(lm3533);
> }
[Severity: High]
This is a pre-existing issue, but can the device initialization in
lm3533_device_init() write past the bounds of the lm3533_devices array?
The array is allocated based on the total number of child nodes:
lm3533_devices = devm_kcalloc(dev, nchilds, sizeof(*lm3533_devices),
GFP_KERNEL);
However, inside the device_for_each_child_node_scoped() loop, the
compatibility checks are independent if statements without an else if or
continue:
if (fwnode_device_is_compatible(child, "ti,lm3533-als")) {
lm3533_devices[count].name = "lm3533-als";
...
count++;
}
if (fwnode_device_is_compatible(child, "ti,lm3533-backlight")) {
...
count++;
}
If a single child node contains multiple matching compatible strings,
such as "ti,lm3533-als" and "ti,lm3533-backlight", count will be
incremented multiple times during a single loop iteration.
Since the bounds check if (count >= nchilds) break; only happens at the
start of the loop, this sequence would allow count to exceed nchilds,
writing out of bounds on the lm3533_devices array.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260606045738.21050-1-clamor95@gmail.com?part=10
next prev parent reply other threads:[~2026-06-06 5:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-06 4:57 [PATCH v4 00/14] mfd: lm3533: convert to OF bindings, improve support Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 01/14] dt-bindings: leds: Document TI LM3533 LED controller Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 02/14] mfd: lm3533: Remove driver specific regmap wrappers Svyatoslav Ryhel
2026-06-06 6:53 ` Andy Shevchenko
2026-06-06 7:22 ` Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 03/14] mfd: lm3533: Remove extern from shared functions in the header Svyatoslav Ryhel
2026-06-06 6:46 ` Andy Shevchenko
2026-06-06 4:57 ` [PATCH v4 04/14] mfd: lm3533: Pass only regmap and light sensor presence to child devices Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 05/14] iio: light: lm3533-als: Remove redundant pdata helpers Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 06/14] mfd: lm3533-core: " Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 07/14] mfd: lm3533: Switch sysfs_create_group() to device_add_group() Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 08/14] mfd: lm3533: Convert to use OF bindings Svyatoslav Ryhel
2026-06-06 5:14 ` sashiko-bot
2026-06-06 4:57 ` [PATCH v4 09/14] mfd: lm3533: Add support for VIN power supply Svyatoslav Ryhel
2026-06-06 4:57 ` [PATCH v4 10/14] mfd: lm3533: Set DMA mask Svyatoslav Ryhel
2026-06-06 5:08 ` sashiko-bot [this message]
2026-06-06 4:57 ` [PATCH v4 11/14] video: backlight: lm3533_bl: Improve logic of sysfs functions Svyatoslav Ryhel
2026-06-06 5:12 ` sashiko-bot
2026-06-06 4:57 ` [PATCH v4 12/14] video: backlight: lm3533_bl: Set initial mapping mode from DT Svyatoslav Ryhel
2026-06-06 5:16 ` sashiko-bot
2026-06-06 4:57 ` [PATCH v4 13/14] video: backlight: lm3533_bl: Implement backlight_scale property Svyatoslav Ryhel
2026-06-06 5:17 ` sashiko-bot
2026-06-06 4:57 ` [PATCH v4 14/14] video: leds: backlight: lm3533: Support getting LED sources from DT Svyatoslav Ryhel
2026-06-06 5:21 ` 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=20260606050839.1278C1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=clamor95@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robh@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox