linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: Fix for setting the thermal zone mode to enable/disable
@ 2012-03-21 11:10 Amit Daniel Kachhap
  2012-03-21 14:13 ` Jean Delvare
  2012-03-22  5:14 ` Len Brown
  0 siblings, 2 replies; 8+ messages in thread
From: Amit Daniel Kachhap @ 2012-03-21 11:10 UTC (permalink / raw)
  To: linux-pm
  Cc: linux-kernel, linux-acpi, lenb, khali, linaro-dev, amit.kachhap,
	patches

Basically without this patch changing the mode of thermal zone
is not possible as wrong string size is passed to strncmp.

Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 drivers/thermal/thermal_sys.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 220ce7e..96da1af 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -152,9 +152,9 @@ mode_store(struct device *dev, struct device_attribute *attr,
 	if (!tz->ops->set_mode)
 		return -EPERM;
 
-	if (!strncmp(buf, "enabled", sizeof("enabled")))
+	if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
 		result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
-	else if (!strncmp(buf, "disabled", sizeof("disabled")))
+	else if (!strncmp(buf, "disabled", sizeof("disabled") - 1))
 		result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
 	else
 		result = -EINVAL;
-- 
1.7.1


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

end of thread, other threads:[~2012-03-22  5:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 11:10 [PATCH] thermal: Fix for setting the thermal zone mode to enable/disable Amit Daniel Kachhap
2012-03-21 14:13 ` Jean Delvare
2012-03-21 14:47   ` Eric Paris
2012-03-21 15:18     ` Jean Delvare
2012-03-21 15:14   ` Geert Uytterhoeven
2012-03-21 15:27     ` Jean Delvare
2012-03-22  5:10   ` Amit Kachhap
2012-03-22  5:14 ` 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).