From: Amit Daniel Kachhap Date: Wed, 21 Mar 2012 11:10:01 +0000 (+0530) Subject: thermal: Fix for setting the thermal zone mode to enable/disable X-Git-Tag: firefly_0821_release~3680^2~2945^2~3^9~3 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f1f0e2ac596f531c15b7b09ebeb8cfd011fffbd2;p=firefly-linux-kernel-4.4.55.git thermal: Fix for setting the thermal zone mode to enable/disable 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 Acked-by: Jean Delvare Signed-off-by: Len Brown --- diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index fab970d9e3e1..022bacb71a7e 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -150,9 +150,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;