mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
hwmon: (nct6775) Fix loop limit
[ Upstream commit91bb8f45f7
] Commitcc66b30382
("hwmon: (nct6775) Rework temperature source and label handling") changed a loop limit from "data->temp_label_num - 1" to "32", as part of moving from a string array to a bit mask. This results in the following error, reported by UBSAN. UBSAN: Undefined behaviour in drivers/hwmon/nct6775.c:4179:27 shift exponent 32 is too large for 32-bit type 'long unsigned int' Similar to the original loop, the limit has to be one less than the number of bits. Fixes:cc66b30382
("hwmon: (nct6775) Rework temperature source and label handling") Reported-by: Paul Menzel <pmenzel+linux-hwmon@molgen.mpg.de> Cc: Paul Menzel <pmenzel+linux-hwmon@molgen.mpg.de> Tested-by: Paul Menzel <pmenzel+linux-hwmon@molgen.mpg.de> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c0f29f9d8a
commit
4dff89e722
1 changed files with 1 additions and 1 deletions
|
@ -4107,7 +4107,7 @@ static int nct6775_probe(struct platform_device *pdev)
|
|||
* The temperature is already monitored if the respective bit in <mask>
|
||||
* is set.
|
||||
*/
|
||||
for (i = 0; i < 32; i++) {
|
||||
for (i = 0; i < 31; i++) {
|
||||
if (!(data->temp_mask & BIT(i + 1)))
|
||||
continue;
|
||||
if (!reg_temp_alternate[i])
|
||||
|
|
Loading…
Reference in a new issue