LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch 1/6] Generic thermal management: validate input parameters
@ 2008-02-15  5:22 Thomas, Sujith
  2008-02-15  6:09 ` Len Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas, Sujith @ 2008-02-15  5:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: lenb, mingo, linux-acpi, linux-kernel, linux-pm, Zhang, Rui

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

Added sanity check to make sure that thermal zone
and cooling device exists.

Signed-off-by: Thomas Sujith <sujith.thomas@intel.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 =

[-- Attachment #2: [patch 1 of 6] Thermal Management - validate input parameters --]
[-- Type: application/octet-stream, Size: 1095 bytes --]

From: Thomas Sujith <sujith.thomas@intel.com>

Added sanity check to make sure that thermal zone
and cooling device exists.

Signed-off-by: Thomas Sujith <sujith.thomas@intel.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 =

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

* Re: [patch 1/6] Generic thermal management: validate input parameters
  2008-02-15  5:22 [patch 1/6] Generic thermal management: validate input parameters Thomas, Sujith
@ 2008-02-15  6:09 ` Len Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Len Brown @ 2008-02-15  6:09 UTC (permalink / raw)
  To: Thomas, Sujith
  Cc: Andrew Morton, mingo, linux-acpi, linux-kernel, linux-pm, Zhang, Rui

On Friday 15 February 2008 00:22, Thomas, Sujith wrote:
> From: Thomas Sujith <sujith.thomas@intel.com>

Thanks Sujith, this patch series was a massive improvement over the last one --
checkpatch.pl clean and everything:-)

I think if you can get rid of the outlook-destroys-plain text via word-wrap
so you don't need to also attach the patches, then you're cookin' with gas.

In the mean time, I've loaded the attachments into the acpi test tree.
if you send more attachments in the future, please start them
with the 1st line as a Subject: so they look to the tools like e-mail.

eg.

Subject: intel_menlo: extract return values using PTR_ERR
From: Thomas Sujith <sujith.thomas@intel.com>

Need to extract errors using PTR_ERR macro and...


thanks,
-Len

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

end of thread, other threads:[~2008-02-15  6:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15  5:22 [patch 1/6] Generic thermal management: validate input parameters Thomas, Sujith
2008-02-15  6:09 ` Len Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).