All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] ACPI: Check parameter when calling acpi_processor_get/set_throttling
@ 2008-01-28  5:53 Zhao Yakui
  2008-02-02  7:29 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Zhao Yakui @ 2008-01-28  5:53 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi

Subject: ACPI : Check parameter when calling acpi_processor_get/set_throttling
>From : Zhao Yakui <yakui.zhao@intel.com>

It is necessary to check the parameter when calling the function of 
acpi_processor_get/set_throttling function so as to avoid the NULL 
pointer reference in pr or throttling.

http://bugzilla.kernel.org/show_bug.cgi?id=9747

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
---
 drivers/acpi/processor_throttling.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: linux-2.6/drivers/acpi/processor_throttling.c
===================================================================
--- linux-2.6.orig/drivers/acpi/processor_throttling.c
+++ linux-2.6/drivers/acpi/processor_throttling.c
@@ -589,6 +589,11 @@ static int acpi_processor_get_throttling
 	cpumask_t saved_mask;
 	int ret;
 
+	if (!pr)
+		return -EINVAL;
+
+	if (!pr->flags.throttling)
+		return -ENODEV;
 	/*
 	 * Migrate task to the cpu pointed by pr.
 	 */
@@ -743,6 +748,16 @@ int acpi_processor_set_throttling(struct
 {
 	cpumask_t saved_mask;
 	int ret;
+
+	if (!pr)
+		return -EINVAL;
+
+	if (!pr->flags.throttling)
+		return -ENODEV;
+
+	if ((state < 0) || (state > (pr->throttling.state_count - 1)))
+		return -EINVAL;
+
 	/*
 	 * Migrate task to the cpu pointed by pr.
 	 */



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-02  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-28  5:53 [PATCH 2/5] ACPI: Check parameter when calling acpi_processor_get/set_throttling Zhao Yakui
2008-02-02  7:29 ` Len Brown

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.