mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tobias Johansson <Tobias.Johansson@axis.com>
To: "lee@kernel.org" <lee@kernel.org>,
	Tobias Johansson <Tobias.Johansson@axis.com>
Cc: "pavel@kernel.org" <pavel@kernel.org>,
	"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kernel <Kernel@axis.com>
Subject: Re: [PATCH] leds: lp50xx: Read default intensity from devicetree
Date: Mon, 23 Nov 2026 12:36:07 +0000	[thread overview]
Message-ID: <4d98d460cc5db453139e6dc2953988ca6282a06f.camel@axis.com> (raw)
In-Reply-To: <179442102947.44545.9103121805533352120@kernel.org>

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

      reply	other threads:[~2026-11-23 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 12:58 Tobias Johansson
2026-11-19  9:52 ` Lee Jones
2026-11-23 12:36   ` Tobias Johansson [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=4d98d460cc5db453139e6dc2953988ca6282a06f.camel@axis.com \
    --to=tobias.johansson@axis.com \
    --cc=Kernel@axis.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    /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

all inboxes | Powered by JetHome®