hwmon: (nct6775) Fix access to temperature configuration registers
authorGuenter Roeck <linux@roeck-us.net>
Wed, 21 Feb 2024 14:01:20 +0000 (06:01 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 21 Feb 2024 21:56:33 +0000 (13:56 -0800)
commitd56e460e19ea8382f813eb489730248ec8d7eb73
tree92f27ee9b80ccb0887039b58973e6828e25e2271
parent841c35169323cd833294798e58b9bf63fa4fa1de
hwmon: (nct6775) Fix access to temperature configuration registers

The number of temperature configuration registers does
not always match the total number of temperature registers.
This can result in access errors reported if KASAN is enabled.

BUG: KASAN: global-out-of-bounds in nct6775_probe+0x5654/0x6fe9 nct6775_core

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/linux-hwmon/d51181d1-d26b-42b2-b002-3f5a4037721f@roeck-us.net/
Fixes: b7f1f7b2523a ("hwmon: (nct6775) Additional TEMP registers for nct6799")
Cc: Ahmad Khalifa <ahmad@khalifa.ws>
Tested-by: Ahmad Khalifa <ahmad@khalifa.ws>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct6775-core.c