From: Zhang Rui Date: Thu, 11 Sep 2008 02:56:00 +0000 (+0800) Subject: intel_menlow: don't set max_state a negative value X-Git-Tag: v2.6.28-rc5~77^2~6^2~18 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c2d06fe338912ee56c2ddd7de5574d5396ed8050;p=linux-2.6-omap-h63xx.git intel_menlow: don't set max_state a negative value max_state is unsigned long. don't set max_state a negative value Cc : Thomas Sujith Cc : Roel Kluin Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c index e00a2756e97..124b37ddb5c 100644 --- a/drivers/misc/intel_menlow.c +++ b/drivers/misc/intel_menlow.c @@ -71,6 +71,9 @@ static int memory_get_int_max_bandwidth(struct thermal_cooling_device *cdev, if (ACPI_FAILURE(status)) return -EFAULT; + if (!value) + return -EINVAL; + *max_state = value - 1; return 0; } @@ -121,7 +124,7 @@ static int memory_set_cur_bandwidth(struct thermal_cooling_device *cdev, if (memory_get_int_max_bandwidth(cdev, &max_state)) return -EFAULT; - if (max_state < 0 || state > max_state) + if (state > max_state) return -EINVAL; arg_list.count = 1;