[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <05B550FD4BD2014E841D83547B62600802AA64FF@bgsmsx411.gar.corp.intel.com>
Date: Fri, 15 Feb 2008 10:52:44 +0530
From: "Thomas, Sujith" <sujith.thomas@...el.com>
To: "Andrew Morton" <akpm@...ux-foundation.org>
Cc: <lenb@...nel.org>, <mingo@...e.hu>, <linux-acpi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-pm@...ts.linux-foundation.org>,
"Zhang, Rui" <rui.zhang@...el.com>
Subject: [patch 1/6] Generic thermal management: validate input parameters
From: Thomas Sujith <sujith.thomas@...el.com>
Added sanity check to make sure that thermal zone
and cooling device exists.
Signed-off-by: Thomas Sujith <sujith.thomas@...el.com>
---
drivers/thermal/thermal.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletion(-)
Index: linux-2.6.24/drivers/thermal/thermal.c
===================================================================
--- linux-2.6.24.orig/drivers/thermal/thermal.c
+++ linux-2.6.24/drivers/thermal/thermal.c
@@ -306,12 +306,23 @@ int thermal_zone_bind_cooling_device(str
{
struct thermal_cooling_device_instance *dev;
struct thermal_cooling_device_instance *pos;
+ struct thermal_zone_device *pos1;
+ struct thermal_cooling_device *pos2;
int result;
if (trip >= tz->trips || (trip < 0 && trip !=
THERMAL_TRIPS_NONE))
return -EINVAL;
- if (!tz || !cdev)
+ list_for_each_entry(pos1, &thermal_tz_list, node) {
+ if (pos1 == tz)
+ break;
+ }
+ list_for_each_entry(pos2, &thermal_cdev_list, node) {
+ if (pos2 == cdev)
+ break;
+ }
+
+ if (tz != pos1 || cdev != pos2)
return -EINVAL;
dev =
Download attachment "[patch 1 of 6] Thermal Management - validate input parameters" of type "application/octet-stream" (1095 bytes)
Powered by blists - more mailing lists