Re: [PATCH] leds: lp50xx: Read default intensity from devicetree

From: Tobias Johansson

Date: Mon Nov 23 2026 - 07:36:26 EST


On Thu, 2026-11-19 at 09:52 +0000, Lee Jones wrote:
> On Mon, 09 Nov 2026, Tobias Johansson wrote:
>
> Please review, explain or fix the Sashiko review(s).
>

The issue Sashiko flagged is a real pre-existing bug: num_colors is
incremented for every child node, so a devicetree with more than three
sub-LED nodes reusing valid reg indices makes num_colors exceed the
subled_info allocation. I can fix this by rejecting LED nodes with more
than LP50XX_LEDS_PER_MODULE children.

> > + fwnode_property_read_u32(led_node,
> > "default-intensity",
> > +
> > &mc_led_info[multi_index].intensity);
>
> (multi_index >= LP50XX_LEDS_PER_MODULE) only tests for values too
> large.
>
> What happens if `multi_index` is < 0?  OOB?
>

Yes, good catch. multi_index is read with fwnode_property_read_u32()
into a signed int, so values with the high bit set become negative and
bypass the upper-bound check, causing an OOB write. I can change
multi_index to u32 so the existing check covers it.

Since both issues are pre-existing and caused by malformed devicetrees,
I can send up a new patch series to fix these two issues hopefully
sometime this week.
>

Thanks,
Tobias