aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_throttling.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2008-01-28 00:53:30 -0500
committerLen Brown <len.brown@intel.com>2008-02-02 02:29:58 -0500
commit87654273ef63213f90c4243913987436495824f0 (patch)
tree153e50bad32997325657b78d759855e797dac20d /drivers/acpi/processor_throttling.c
parent3abbd337c60591305cbfeb984ff2922c175be37f (diff)
ACPI : Check parameter when calling acpi_processor_get/set_throttling
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> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_throttling.c')
-rw-r--r--drivers/acpi/processor_throttling.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 1685b40abda7..5d2eae207886 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -589,6 +589,11 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
589 cpumask_t saved_mask; 589 cpumask_t saved_mask;
590 int ret; 590 int ret;
591 591
592 if (!pr)
593 return -EINVAL;
594
595 if (!pr->flags.throttling)
596 return -ENODEV;
592 /* 597 /*
593 * Migrate task to the cpu pointed by pr. 598 * Migrate task to the cpu pointed by pr.
594 */ 599 */
@@ -743,6 +748,16 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
743{ 748{
744 cpumask_t saved_mask; 749 cpumask_t saved_mask;
745 int ret; 750 int ret;
751
752 if (!pr)
753 return -EINVAL;
754
755 if (!pr->flags.throttling)
756 return -ENODEV;
757
758 if ((state < 0) || (state > (pr->throttling.state_count - 1)))
759 return -EINVAL;
760
746 /* 761 /*
747 * Migrate task to the cpu pointed by pr. 762 * Migrate task to the cpu pointed by pr.
748 */ 763 */