[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aByIzTj2t1I9Wrzw@stanley.mountain>
Date: Thu, 8 May 2025 13:34:53 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: Niklas Cassel <niklas.cassel@...aro.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] pmdomain: core: Fix error checking in
genpd_dev_pm_attach_by_id()
On Thu, May 08, 2025 at 12:14:41PM +0200, Ulf Hansson wrote:
> On Thu, 8 May 2025 at 08:29, Dan Carpenter <dan.carpenter@...aro.org> wrote:
> >
> > The error checking for of_count_phandle_with_args() does not handle
> > negative error codes correctly. The problem is that "index" is a u32 so
> > in the condition "if (index >= num_domains)" negative error codes stored
> > in "num_domains" are type promoted to very high positive values and
> > "index" is always going to be valid.
> >
> > Test for negative error codes first and then test if "index" is valid.
> >
> > Fixes: 3ccf3f0cd197 ("PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain")
> > Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
>
> Thanks for the fix! It looks correct to me!
>
> What puzzles me though, if this is a real problem I am sure we would
> have been receiving bug reports, don't you think?
>
I think it would only cause an issue for invalid devicetrees? So it's
probably not an issue people often see in real life.
regards,
dan carpenter
Powered by blists - more mailing lists