All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Mike Chan <mike@android.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] omap: pm: Fix overflow when doing powerdomain deps  lookups.
Date: Tue, 11 Aug 2009 17:14:00 -0700	[thread overview]
Message-ID: <87zla551o7.fsf@deeprootsystems.com> (raw)
In-Reply-To: <8bb80c380908111111m5a0a3417n3fea568cb8ea9124@mail.gmail.com> (Mike Chan's message of "Tue\, 11 Aug 2009 11\:11\:43 -0700")

Mike Chan <mike@android.com> writes:

> On Tue, Aug 11, 2009 at 7:38 AM, Kevin
> Hilman<khilman@deeprootsystems.com> wrote:
>> Mike Chan <mike@android.com> writes:
>>
>>> Signed-off-by: Mike Chan <mike@android.com>
>>> ---
>>>  arch/arm/mach-omap2/powerdomain.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
>>> index 0334609..6077629 100644
>>> --- a/arch/arm/mach-omap2/powerdomain.c
>>> +++ b/arch/arm/mach-omap2/powerdomain.c
>>> @@ -90,7 +90,7 @@ static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm,
>>>       if (!pwrdm || !deps || !omap_chip_is(pwrdm->omap_chip))
>>>               return ERR_PTR(-EINVAL);
>>>
>>> -     for (pd = deps; pd; pd++) {
>>> +     for (pd = deps; pd->pwrdm_name; pd++) {
>>
>> Maybe should be:
>>
>>        for (pd = deps; pd && pd->pwrdm_name; pd++) {
>>
>
> At the end of the list pd is a pointer to a NULL struct, so checking
> if the address == NULL doesn't help here. In fact the original code
> will just keep running past the struct to read who knows what in
> memory.

I see that now, didn't notice the NULL struct terminators.

> This case manifests itself when from clkdms_setup() when enabling auto
> idle for a clock domain and the clockdomain usecount is greater than
> 0. When _clkdm_add_autodeps() tries to add the a dependency that does
> not exist in the powerdomain->wkdep_srcs array the for loop will run
> past the wkdep_srcs array.

Thanks, will add this as changelog and push to PM branch as well as
pm-2.6.29.

Kevin

> Currently in linux-omap you won't hit this because the not found case
> is never executed, unless you start modifying powerdomains and their
> wakeup/sleep deps.
>
> --Mike
>
>> ?
>>
>>>
>>>               if (!omap_chip_is(pd->omap_chip))
>>>                       continue;
>>
>> Also, a descriptive changelog would be helpful here describing the
>> conditions where you saw overflow etc.
>>
>> Kevin
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-08-12  0:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11  2:00 [PATCH] omap: pm: Fix overflow when doing powerdomain deps lookups Mike Chan
2009-08-11 14:38 ` Kevin Hilman
2009-08-11 18:11   ` Mike Chan
2009-08-12  0:14     ` Kevin Hilman [this message]
2009-08-12  6:32     ` Paul Walmsley
2009-08-12 17:58       ` Mike Chan

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=87zla551o7.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=mike@android.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.