kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] thermal: underflow bug in imx_set_trip_temp()
@ 2015-08-21  8:49 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-08-21  8:49 UTC (permalink / raw)
  To: Zhang Rui, Sascha Hauer
  Cc: Eduardo Valentin, linux-pm, kernel-janitors, lm-sensors

We recently changed this from unsigned long to int so it introduced an
underflow bug.

Fixes: 17e8351a7739 ('thermal: consistently use int for temperatures')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 4bec1d3..7a06465 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -288,7 +288,7 @@ static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip,
 	if (trip = IMX_TRIP_CRITICAL)
 		return -EPERM;
 
-	if (temp > IMX_TEMP_PASSIVE)
+	if (temp < 0 || temp > IMX_TEMP_PASSIVE)
 		return -EINVAL;
 
 	data->temp_passive = temp;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-08-21  8:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-21  8:49 [patch] thermal: underflow bug in imx_set_trip_temp() Dan Carpenter

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).