thermal: underflow bug in imx_set_trip_temp()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 21 Aug 2015 08:49:09 +0000 (11:49 +0300)
committerEduardo Valentin <edubezval@gmail.com>
Fri, 30 Oct 2015 18:35:50 +0000 (11:35 -0700)
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>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/imx_thermal.c

index acd1c78687353e26bb6e3f40c6b98e91d090df58..c8fe3cac2e0e04d8196694f264b6d9f4fcd5cc5d 100644 (file)
@@ -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;