All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janosch Machowinski <scotch-cGBD8117FJM@public.gmane.org>
To: Dominik Brodowski
	<linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.org>
Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: PATCH default C1
Date: Sat, 17 Sep 2005 13:29:17 +0200	[thread overview]
Message-ID: <432BFE0D.8060006@tzi.de> (raw)
In-Reply-To: <20050917091344.GB1522-JwFqNg2GrOVrgjWwlLH9qw@public.gmane.org>

Dominik Brodowski schrieb:
> Hi,
> 
> 
> On Fri, Sep 16, 2005 at 09:03:36PM +0200, Janosch Machowinski wrote:
> 
>>@@ -678,6 +669,13 @@
>> 
>> 		(pr->power.count)++;
>> 		memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx));
>>+
>>+		/* We support up to ACPI_PROCESSOR_MAX_POWER. */
>>+		if (pr->power.count >= ACPI_PROCESSOR_MAX_POWER) {
>>+		        printk(KERN_WARNING "Limiting number of power states to max (%d)\n", ACPI_PROCESSOR_MAX_POWER);
>>+			printk(KERN_WARNING "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");
>>+			break;
>>+		}
> 
> 
> 
> Memory corruption: If pr->power.count is ACPI_PROCESSOR_MAX_POWER (or
> larger), pr->power.states[pr->power.count] is pointing to an invalid memory
> address. Therefore, the check needs to stay at the place it was before.
> 
Hu ?
I think teh check is just right where I placed it...
Following case :
A CST contains 9 C-states,
MAX_POWER = 8.
One C-State is invallid (not the last one)
In this case we would only detect 7 C-states (with the check in old place)
pr->power.count tells us how many C-States where actually discovered, 
that's why I moved the check.

But you're right, it runs out of the array...
what about ?
Is there a nicer way to do this ?
+		if (pr->power.count >= (ACPI_PROCESSOR_MAX_POWER -1)) {

    Janosch


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

      parent reply	other threads:[~2005-09-17 11:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-13  9:11 PATCH default C1 Janosch Machowinski
     [not found] ` <432697CC.3020201-cGBD8117FJM@public.gmane.org>
2005-09-13 18:02   ` Dominik Brodowski
     [not found]     ` <20050913180219.GB9572-X3ehHDuj6sIIGcDfoQAp7BvVK+yQ3ZXh@public.gmane.org>
2005-09-16 19:03       ` Janosch Machowinski
     [not found]         ` <432B1708.4060403-cGBD8117FJM@public.gmane.org>
2005-09-17  9:13           ` Dominik Brodowski
     [not found]             ` <20050917091344.GB1522-JwFqNg2GrOVrgjWwlLH9qw@public.gmane.org>
2005-09-17 11:29               ` Janosch Machowinski [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=432BFE0D.8060006@tzi.de \
    --to=scotch-cgbd8117fjm@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=linux-X3ehHDuj6sIIGcDfoQAp7OTW4wlIGRCZ@public.gmane.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 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.