Patch "hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms" has been added to the 6.0-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: (sht4x) do not overflow clamping operation on 32-bit platforms

to the 6.0-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-sht4x-do-not-overflow-clamping-operation-on-32.patch
and it can be found in the queue-6.0 subdirectory.

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



commit 77cabc0788ee73c6911cda0dca43bb74255ef897
Author: Jason A. Donenfeld <Jason@xxxxxxxxx>
Date:   Sat Sep 24 12:11:51 2022 +0200

    hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms
    
    [ Upstream commit f9c0cf8f26de367c58e48b02b1cdb9c377626e6f ]
    
    On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than
    (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is
    bogus. Fix this by clamping at INT_MAX, so that the upperbound is the
    same on all platforms.
    
    Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220924101151.4168414-1-Jason@xxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c
index c19df3ade48e..13ac2d8f22c7 100644
--- a/drivers/hwmon/sht4x.c
+++ b/drivers/hwmon/sht4x.c
@@ -129,7 +129,7 @@ static int sht4x_read_values(struct sht4x_data *data)
 
 static ssize_t sht4x_interval_write(struct sht4x_data *data, long val)
 {
-	data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, UINT_MAX);
+	data->update_interval = clamp_val(val, SHT4X_MIN_POLL_INTERVAL, INT_MAX);
 
 	return 0;
 }



[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