From patchwork Fri Apr 24 03:24:23 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 19729 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 n3O3OTwA014510 for ; Fri, 24 Apr 2009 03:24:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752874AbZDXDY2 (ORCPT ); Thu, 23 Apr 2009 23:24:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752894AbZDXDY2 (ORCPT ); Thu, 23 Apr 2009 23:24:28 -0400 Received: from vms173009pub.verizon.net ([206.46.173.9]:62918 "EHLO vms173009pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbZDXDY1 (ORCPT ); Thu, 23 Apr 2009 23:24:27 -0400 Received: from localhost.localdomain ([96.237.168.40]) by vms173009.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KIL001XX5GOY7WM@vms173009.mailsrvcs.net> for linux-acpi@vger.kernel.org; Thu, 23 Apr 2009 22:24:25 -0500 (CDT) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n3O3ONQB017646; Thu, 23 Apr 2009 23:24:24 -0400 Received: from localhost (lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) with ESMTP id n3O3ONPn017642; Thu, 23 Apr 2009 23:24:23 -0400 X-Authentication-warning: localhost.localdomain: lenb owned process doing -bs Date: Thu, 23 Apr 2009 23:24:23 -0400 (EDT) From: Len Brown X-X-Sender: lenb@localhost.localdomain To: yakui_zhao Cc: linux-acpi@vger.kernel.org Subject: Re: [PATCH]: ACPI: Add the module param check for processor.max_cstate In-reply-to: <1240539912.3651.68.camel@localhost.localdomain> Message-id: References: <1240539912.3651.68.camel@localhost.localdomain> 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 From: Len Brown Subject: [PATCH] ACPI: prevent processor.max_cstate=0 boot crash As processor.max_cstate is an init-time-only modparam, sanity checking it at init-time is sufficient. http://bugzilla.kernel.org/show_bug.cgi?id=13142 Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 6fe1214..436127e 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1037,6 +1037,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) dev->states[i].desc[0] = '\0'; } + if (max_cstate == 0) + max_cstate = 1; + for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) { cx = &pr->power.states[i]; state = &dev->states[count];