Patch "hwmon: (pt5161l) Fix invalid temperature reading" has been added to the 6.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hwmon: (pt5161l) Fix invalid temperature reading

to the 6.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-pt5161l-fix-invalid-temperature-reading.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6795d41f4fc6530c62ea2c7aa22136099cb8d9ef
Author: Cosmo Chou <chou.cosmo@xxxxxxxxx>
Date:   Mon Aug 19 18:46:30 2024 +0800

    hwmon: (pt5161l) Fix invalid temperature reading
    
    [ Upstream commit 7bbc079531fc38d401e1c4088d4981435a8828e3 ]
    
    The temperature reading function was using a signed long for the ADC
    code, which could lead to mishandling of invalid codes on 32-bit
    platforms. This allowed out-of-range ADC codes to be incorrectly
    interpreted as valid values and used in temperature calculations.
    
    Change adc_code to u32 to ensure that invalid ADC codes are correctly
    identified on all platforms.
    
    Fixes: 1b2ca93cd059 ("hwmon: Add driver for Astera Labs PT5161L retimer")
    Signed-off-by: Cosmo Chou <chou.cosmo@xxxxxxxxx>
    Message-ID: <20240819104630.2375441-1-chou.cosmo@xxxxxxxxx>
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/pt5161l.c b/drivers/hwmon/pt5161l.c
index b0d58a26d499d..a9f0b23f9e76e 100644
--- a/drivers/hwmon/pt5161l.c
+++ b/drivers/hwmon/pt5161l.c
@@ -427,7 +427,7 @@ static int pt5161l_read(struct device *dev, enum hwmon_sensor_types type,
 	struct pt5161l_data *data = dev_get_drvdata(dev);
 	int ret;
 	u8 buf[8];
-	long adc_code;
+	u32 adc_code;
 
 	switch (attr) {
 	case hwmon_temp_input:
@@ -449,7 +449,7 @@ static int pt5161l_read(struct device *dev, enum hwmon_sensor_types type,
 
 		adc_code = buf[3] << 24 | buf[2] << 16 | buf[1] << 8 | buf[0];
 		if (adc_code == 0 || adc_code >= 0x3ff) {
-			dev_dbg(dev, "Invalid adc_code %lx\n", adc_code);
+			dev_dbg(dev, "Invalid adc_code %x\n", adc_code);
 			return -EIO;
 		}
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux