* [PATCH 6.1.y 2/4] hwmon: (nct6775-platform) Explicitly initialize nct6775_sio_names indexes
2026-12-04 3:42 ` [PATCH 6.1.y 1/4] hwmon: (nct6775) Change labels for nct6799 Sasha Levin
@ 2026-12-04 3:42 ` Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 3/4] hwmon: (nct6775-core) Explicitly initialize nct6775_device_names indexes Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 4/4] hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126 Sasha Levin
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-12-04 3:42 UTC (permalink / raw)
To: stable
Cc: Kees Cook, Guenter Roeck, Rob Herring, Jean Delvare, linux-hwmon,
Sasha Levin
From: Kees Cook <keescook@chromium.org>
[ Upstream commit efe86092ab316db8d3c6e98f57b193511a09a073 ]
Changing the "kinds" enum start value to be 1-indexed instead of
0-indexed caused look-ups in nct6775_sio_namesp[] to be misaligned or
off the end. Coverity reported:
*** CID 1571052: Memory - illegal accesses (OVERRUN)
drivers/hwmon/nct6775-platform.c:1075 in nct6775_find()
1069 sio_data->kind == nct6793 || sio_data->kind == nct6795 ||
1070 sio_data->kind == nct6796 || sio_data->kind == nct6797 ||
1071 sio_data->kind == nct6798 || sio_data->kind == nct6799)
1072 nct6791_enable_io_mapping(sio_data);
1073
1074 sio_data->sio_exit(sio_data);
vvv CID 1571052: Memory - illegal accesses (OVERRUN)
vvv Overrunning array "nct6775_sio_names" of 13 8-byte elements at element index 13 (byte offset 111) using index "sio_data->kind" (which evaluates to 13).
1075 pr_info("Found %s or compatible chip at %#x:%#x\n",
1076 nct6775_sio_names[sio_data->kind], sioaddr, addr);
1077
1078 return addr;
1079 }
1080
Initialize the string list with explicit indexes.
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rob Herring <robh@kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: linux-hwmon@vger.kernel.org
Fixes: 10a0575ea09d ("hwmon: nct6775-i2c: Use i2c_get_match_data()")
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20231116140144.work.027-kees@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/nct6775-platform.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/hwmon/nct6775-platform.c b/drivers/hwmon/nct6775-platform.c
index 9e68c99250afc..0631898a30703 100644
--- a/drivers/hwmon/nct6775-platform.c
+++ b/drivers/hwmon/nct6775-platform.c
@@ -23,19 +23,19 @@
enum sensor_access { access_direct, access_asuswmi };
static const char * const nct6775_sio_names[] __initconst = {
- "NCT6106D",
- "NCT6116D",
- "NCT6775F",
- "NCT6776D/F",
- "NCT6779D",
- "NCT6791D",
- "NCT6792D",
- "NCT6793D",
- "NCT6795D",
- "NCT6796D",
- "NCT6797D",
- "NCT6798D",
- "NCT6796D-S/NCT6799D-R",
+ [nct6106] = "NCT6106D",
+ [nct6116] = "NCT6116D",
+ [nct6775] = "NCT6775F",
+ [nct6776] = "NCT6776D/F",
+ [nct6779] = "NCT6779D",
+ [nct6791] = "NCT6791D",
+ [nct6792] = "NCT6792D",
+ [nct6793] = "NCT6793D",
+ [nct6795] = "NCT6795D",
+ [nct6796] = "NCT6796D",
+ [nct6797] = "NCT6797D",
+ [nct6798] = "NCT6798D",
+ [nct6799] = "NCT6796D-S/NCT6799D-R",
};
static unsigned short force_id;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 6.1.y 3/4] hwmon: (nct6775-core) Explicitly initialize nct6775_device_names indexes
2026-12-04 3:42 ` [PATCH 6.1.y 1/4] hwmon: (nct6775) Change labels for nct6799 Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 2/4] hwmon: (nct6775-platform) Explicitly initialize nct6775_sio_names indexes Sasha Levin
@ 2026-12-04 3:42 ` Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 4/4] hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126 Sasha Levin
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-12-04 3:42 UTC (permalink / raw)
To: stable; +Cc: Guenter Roeck, Rob Herring, Kees Cook, Sasha Levin
From: Guenter Roeck <linux@roeck-us.net>
[ Upstream commit 2792fc8f8c834e035b09be42d445085bd8bcac7e ]
Changing the "kinds" enum start value to be 1-indexed instead of
0-indexed caused look-ups in nct6775_device_names[] to be misaligned or
off the end.
Initialize the string list with explicit indexes.
Cc: Rob Herring <robh@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Fixes: 10a0575ea09d ("hwmon: nct6775-i2c: Use i2c_get_match_data()")
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Stable-dep-of: 73d857b33cdf ("hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/nct6775-core.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 62545e1867977..5f335a2046ad2 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -63,19 +63,19 @@
/* used to set data->name = nct6775_device_names[data->sio_kind] */
static const char * const nct6775_device_names[] = {
- "nct6106",
- "nct6116",
- "nct6775",
- "nct6776",
- "nct6779",
- "nct6791",
- "nct6792",
- "nct6793",
- "nct6795",
- "nct6796",
- "nct6797",
- "nct6798",
- "nct6799",
+ [nct6106] = "nct6106",
+ [nct6116] = "nct6116",
+ [nct6775] = "nct6775",
+ [nct6776] = "nct6776",
+ [nct6779] = "nct6779",
+ [nct6791] = "nct6791",
+ [nct6792] = "nct6792",
+ [nct6793] = "nct6793",
+ [nct6795] = "nct6795",
+ [nct6796] = "nct6796",
+ [nct6797] = "nct6797",
+ [nct6798] = "nct6798",
+ [nct6799] = "nct6799",
};
/* Common and NCT6775 specific data */
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 6.1.y 4/4] hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126
2026-12-04 3:42 ` [PATCH 6.1.y 1/4] hwmon: (nct6775) Change labels for nct6799 Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 2/4] hwmon: (nct6775-platform) Explicitly initialize nct6775_sio_names indexes Sasha Levin
2026-12-04 3:42 ` [PATCH 6.1.y 3/4] hwmon: (nct6775-core) Explicitly initialize nct6775_device_names indexes Sasha Levin
@ 2026-12-04 3:42 ` Sasha Levin
2 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2026-12-04 3:42 UTC (permalink / raw)
To: stable; +Cc: Guenter Roeck, Sashiko, Anton Lundin, Sasha Levin
From: Guenter Roeck <linux@roeck-us.net>
[ Upstream commit 73d857b33cdfaf35f8d3f833b36745d91c18db13 ]
In nct6775_probe(), the nct6106, nct6116, and nct6126 chip cases leave
target_temp_mask, tolerance_mask, and speed_tolerance_limit
zero-initialized.
As a result, reading pwm*_target_temp from sysfs always returns 0,
writing to pwm*_target_temp, pwm*_temp_tolerance,
pwm*_crit_temp_tolerance, or fan*_tolerance clamps user-supplied values
to 0, and pwm_update_registers() fails to clear existing tolerance bits
in REG_FAN_MODE when updating fan control modes.
Initialize target_temp_mask to 0xff, tolerance_mask to 0x07, and
speed_tolerance_limit to 63 for NCT6106, NCT6116, and NCT6126, matching
the hardware register layout shared with NCT5525 and NCT6776+.
Fixes: 6c009501ff20 ("hwmon: (nct6775) Add support for NCT6102D/6106D")
Fixes: 29c7cb485b32 ("hwmon: (nct6775) Integrate new model nct6116")
Fixes: 437b3c2a4bdc ("hwmon: (nct6775) Add support for NCT6126D")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/bug/linux-76f191d0-4c79-4982-887e-e5c9a2ed7136
Cc: Anton Lundin <glance@ac2.se>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[ sashal: Dropped the duplicate hunk that upstream applied to a second chip case, since that block doesn't exist in this tree, so the mask and tolerance assignments land only in the one remaining case. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hwmon/nct6775-core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 5f335a2046ad2..3f7f6c8923e07 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -3531,6 +3531,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
data->fan_from_reg = fan_from_reg13;
data->fan_from_reg_min = fan_from_reg13;
+ data->target_temp_mask = 0xff;
+ data->tolerance_mask = 0x07;
+ data->speed_tolerance_limit = 63;
data->temp_label = nct6776_temp_label;
data->temp_mask = NCT6776_TEMP_MASK;
@@ -3607,6 +3610,9 @@ int nct6775_probe(struct device *dev, struct nct6775_data *data,
data->fan_from_reg = fan_from_reg13;
data->fan_from_reg_min = fan_from_reg13;
+ data->target_temp_mask = 0xff;
+ data->tolerance_mask = 0x07;
+ data->speed_tolerance_limit = 63;
data->temp_label = nct6776_temp_label;
data->temp_mask = NCT6776_TEMP_MASK;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread