From patchwork Mon Mar 16 03:36:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 12280 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2G3ajgH028094 for ; Mon, 16 Mar 2009 03:36:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752999AbZCPDgq (ORCPT ); Sun, 15 Mar 2009 23:36:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753507AbZCPDgp (ORCPT ); Sun, 15 Mar 2009 23:36:45 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:30987 "EHLO vms173003pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752999AbZCPDgp (ORCPT ); Sun, 15 Mar 2009 23:36:45 -0400 Received: from localhost.localdomain ([96.237.168.40]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KGK00683Y133KE7@vms173003.mailsrvcs.net> for linux-acpi@vger.kernel.org; Sun, 15 Mar 2009 22:36:39 -0500 (CDT) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n2G3acd4031913; Sun, 15 Mar 2009 23:36:38 -0400 Received: from localhost (lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) with ESMTP id n2G3acJ6031908; Sun, 15 Mar 2009 23:36:38 -0400 X-Authentication-warning: localhost.localdomain: lenb owned process doing -bs Date: Sun, 15 Mar 2009 23:36:38 -0400 (EDT) From: Len Brown X-X-Sender: lenb@localhost.localdomain To: akpm@linux-foundation.org Cc: linux-acpi@vger.kernel.org, roel.kluin@gmail.com, yakui.zhao@intel.com Subject: Re: [patch 4/8] acpi: get_throttling_state() cannot be larger than state_count In-reply-to: <200903041955.n24JtRIO027997@imap1.linux-foundation.org> Message-id: References: <200903041955.n24JtRIO027997@imap1.linux-foundation.org> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org -- Len Brown, Intel Open Source Technology Center On Wed, 4 Mar 2009, akpm@linux-foundation.org wrote: > From: Roel Kluin > > With for(i = 0; i < n; i++) { ... } i reaches n. > > Signed-off-by: Roel Kluin > Acked-by: > Cc: Len Brown > Signed-off-by: Andrew Morton > --- > > drivers/acpi/processor_throttling.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff -puN drivers/acpi/processor_throttling.c~acpi-get_throttling_state-cannot-be-larger-state_count drivers/acpi/processor_throttling.c > --- a/drivers/acpi/processor_throttling.c~acpi-get_throttling_state-cannot-be-larger-state_count > +++ a/drivers/acpi/processor_throttling.c > @@ -785,7 +785,7 @@ static int acpi_get_throttling_state(str > if (tx->control == value) > break; > } > - if (i > pr->throttling.state_count) > + if (i >= pr->throttling.state_count) > i = -1; > return i; > } > _ > how about simply... --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index d278381..5f09901 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -783,11 +783,9 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, (struct acpi_processor_tx_tss *)&(pr->throttling. states_tss[i]); if (tx->control == value) - break; + return i; } - if (i > pr->throttling.state_count) - i = -1; - return i; + return -1; } static int acpi_get_throttling_value(struct acpi_processor *pr,