From: Jon Hunter <jonathanh@nvidia.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
<linux-kernel@vger.kernel.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Kevin Hilman <khilman@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
"Len Brown" <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
<linux-pm@vger.kernel.org>
Subject: Re: [PATCH] PM / Domains: Allow holes in genpd_data.domains array
Date: Thu, 15 Sep 2016 12:03:27 +0100 [thread overview]
Message-ID: <5256c34e-5afb-2cfe-9818-8e6a6e1f0fa3@nvidia.com> (raw)
In-Reply-To: <1473935963-8837-1-git-send-email-tomeu.vizoso@collabora.com>
On 15/09/16 11:39, Tomeu Vizoso wrote:
> In platforms such as Rockchip's, the array of domains isn't always
> filled without holes, as which domains are present depend on the
> particular SoC revision.
>
> By allowing holes to be in the array, such SoCs can still use a single
> set of constants to index the array of power domains.
>
> Fixes: 0159ec670763 ("PM / Domains: Verify the PM domain is present when adding a provider")
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Cc: Jon Hunter <jonathanh@nvidia.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> ---
> drivers/base/power/domain.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index b0cf46dcae73..ce3f483ec67b 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np,
> mutex_lock(&gpd_list_lock);
>
> for (i = 0; i < data->num_domains; i++) {
> + if (!data->domains[i])
> + continue;
> if (!pm_genpd_present(data->domains[i]))
> goto error;
>
Sounds reasonable and sorry I had not thought of this. Can you also make
sure we check that !data->domains[i] in the error path as well or
potentially we could have a NULL pointer dereference in the case of an
actual error.
Cheers
Jon
--
nvpublic
next prev parent reply other threads:[~2016-09-15 11:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 10:39 Tomeu Vizoso
2016-09-15 11:03 ` Jon Hunter [this message]
2016-09-15 12:05 ` [PATCH v2] " Tomeu Vizoso
2016-09-15 13:20 ` Jon Hunter
2016-09-15 14:16 ` Ulf Hansson
2016-09-15 22:00 ` Heiko Stübner
2016-09-16 16:13 ` Kevin Hilman
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=5256c34e-5afb-2cfe-9818-8e6a6e1f0fa3@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=tomeu.vizoso@collabora.com \
--cc=ulf.hansson@linaro.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®