Skip to contentSkip to conversation

thermal: underflow bug in imx_set_trip_temp()

PATCH New Dan Carpenter 1 participant 1 message Aug 21, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: underflow bug in imx_set_trip_temp()

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

Fixes 17e8351a7739 ('thermal: consistently use int for temperatures')
drivers/thermal/imx_thermal.c +1 -1
index 4bec1d3..7a06465 100644
@@ -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;