From: "Doug Smythies" <dsmythies@telus.net>
To: "'Ahmad Khalifa'" <ahmad@khalifa.ws>,
"'Guenter Roeck'" <linux@roeck-us.net>
Cc: "Doug Smythies" <dsmythies@telus.net>,
"'Jean Delvare'" <jdelvare@suse.com>,
<linux-hwmon@vger.kernel.org>
Subject: hwmon: (nct6775) Regression Bisected
Date: Fri, 15 Sep 2023 07:28:57 -0700 [thread overview]
Message-ID: <002101d9e7e0$f67c4490$e374cdb0$@telus.net> (raw)
Kernel 6.6-rc1 has an error during boot. The guilty commit is:
b7f1f7b2523a6a4382f12fe953380b847b80e09d
hwmon: (nct6775) Additional TEMP registers for nct6799
There seems to be confusion between the indexes into
the NCT6799_ALARM_BITS array or the
NCT6779_ALARM_BITS array. I do not understand the code
and do not know if it is the indexing that is reversed or the
wrong table is being used.
The error from kern.log (edited):
================================================================================
UBSAN: shift-out-of-bounds in drivers/hwmon/nct6775-core.c:1757:39
shift exponent -1 is negative
CPU: 9 PID: 822 Comm: sensors Not tainted 6.6.0-rc1-stock2 #1165
Hardware name: ASUS System Product Name/PRIME Z490-A, BIOS 9902 09/15/2021
Call Trace:
<TASK>
dump_stack_lvl+0x48/0x70
dump_stack+0x10/0x20
ubsan_epilogue+0x9/0x40
__ubsan_handle_shift_out_of_bounds+0x10f/0x170
...
I added a "pr_info" line (in the below it was as of the prior commit,
43fbe66dc216 hwmon: Add driver for Renesas HS3001):
doug@s19:~/kernel/linux$ git diff
diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
index 33533d95cf48..12e3df84c034 100644
--- a/drivers/hwmon/nct6775-core.c
+++ b/drivers/hwmon/nct6775-core.c
@@ -1727,6 +1727,7 @@ nct6775_show_alarm(struct device *dev, struct device_attribute *attr, char *buf)
return PTR_ERR(data);
nr = data->ALARM_BITS[sattr->index];
+ pr_info("doug: nr: %d ; index %d\n", nr, sattr->index);
return sprintf(buf, "%u\n",
(unsigned int)((data->alarms >> nr) & 0x01));
}
And for b7f1f7b2523a got (edited):
nct6775_core: doug: nr: 0 ; index 0
nct6775_core: doug: nr: 1 ; index 1
nct6775_core: doug: nr: 2 ; index 2
nct6775_core: doug: nr: 3 ; index 3
nct6775_core: doug: nr: 8 ; index 4
nct6775_core: doug: nr: -1 ; index 5
================================================================================
UBSAN: shift-out-of-bounds in drivers/hwmon/nct6775-core.c:1758:39
shift exponent -1 is negative
...
nct6775_core: doug: nr: 20 ; index 6
nct6775_core: doug: nr: 16 ; index 7
nct6775_core: doug: nr: 17 ; index 8
nct6775_core: doug: nr: 24 ; index 9
nct6775_core: doug: nr: 25 ; index 10
nct6775_core: doug: nr: 26 ; index 11
nct6775_core: doug: nr: 27 ; index 12
nct6775_core: doug: nr: 28 ; index 13
nct6775_core: doug: nr: 29 ; index 14
nct6775_core: doug: nr: 6 ; index 24
nct6775_core: doug: nr: 7 ; index 25
nct6775_core: doug: nr: 11 ; index 26
nct6775_core: doug: nr: 10 ; index 27
nct6775_core: doug: nr: 23 ; index 28
nct6775_core: doug: nr: 33 ; index 29
nct6775_core: doug: nr: 12 ; index 48
nct6775_core: doug: nr: 9 ; index 49
Observe that the table seems to be
NCT6799_ALARM_BITS
But the indexes seem to be for
NCT6779_ALARM_BITS
static const s8 NCT6799_ALARM_BITS[NUM_ALARM_BITS] = {
0, 1, 2, 3, 8, -1, 20, 16, 17, 24, 25, 26, /* in0-in11 */
27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, /* in12-in23 */
6, 7, 11, 10, 23, 33, -1, -1, -1, -1, -1, -1, /* fan1-fan12 */
4, 5, 40, 41, 42, 43, 44, -1, -1, -1, -1, -1, /* temp1-temp12 */
12, 9, /* intr0-intr1 */
};
Now repeat the test as of 43fbe66dc216:
nct6775_core: doug: nr: 0 ; index 0
nct6775_core: doug: nr: 1 ; index 1
nct6775_core: doug: nr: 2 ; index 2
nct6775_core: doug: nr: 3 ; index 3
nct6775_core: doug: nr: 8 ; index 4
nct6775_core: doug: nr: 21 ; index 5
nct6775_core: doug: nr: 20 ; index 6
nct6775_core: doug: nr: 16 ; index 7
nct6775_core: doug: nr: 17 ; index 8
nct6775_core: doug: nr: 24 ; index 9
nct6775_core: doug: nr: 25 ; index 10
nct6775_core: doug: nr: 26 ; index 11
nct6775_core: doug: nr: 27 ; index 12
nct6775_core: doug: nr: 28 ; index 13
nct6775_core: doug: nr: 29 ; index 14
nct6775_core: doug: nr: 6 ; index 24
nct6775_core: doug: nr: 7 ; index 25
nct6775_core: doug: nr: 11 ; index 26
nct6775_core: doug: nr: 10 ; index 27
nct6775_core: doug: nr: 23 ; index 28
nct6775_core: doug: nr: 33 ; index 29
nct6775_core: doug: nr: 12 ; index 48
nct6775_core: doug: nr: 9 ; index 49
Observe that the table seems to be
NCT6779_ALARM_BITS
And the indexing seems to be for that
Table.
static const s8 NCT6779_ALARM_BITS[NUM_ALARM_BITS] = {
0, 1, 2, 3, 8, 21, 20, 16, 17, 24, 25, 26, /* in0-in11 */
27, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* in12-in23 */
6, 7, 11, 10, 23, -1, -1, -1, -1, -1, -1, -1, /* fan1-fan12 */
4, 5, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* temp1-temp12 */
12, 9, /* intr0-intr1 */
};
You probably need this information:
nct6775: Found NCT6798D or compatible chip at 0x2e:0x290
... Doug
next reply other threads:[~2023-09-15 14:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 14:28 Doug Smythies [this message]
2023-09-15 15:00 ` hwmon: (nct6775) Regression Bisected Guenter Roeck
2023-09-16 3:12 ` Guenter Roeck
2023-09-16 16:43 ` Ahmad Khalifa
2023-09-16 17:04 ` Guenter Roeck
2023-09-16 17:45 ` Ahmad Khalifa
2023-09-16 18:11 ` Guenter Roeck
2023-09-16 19:30 ` Doug Smythies
2023-09-16 20:27 ` Guenter Roeck
2023-09-16 18:09 ` Guenter Roeck
2023-09-17 21:17 ` Doug Smythies
2023-09-18 17:02 ` Ahmad Khalifa
2023-09-18 18:21 ` Guenter Roeck
2023-09-16 9:20 ` Bagas Sanjaya
2023-09-21 9:14 ` Linux regression tracking #update (Thorsten Leemhuis)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002101d9e7e0$f67c4490$e374cdb0$@telus.net' \
--to=dsmythies@telus.net \
--cc=ahmad@khalifa.ws \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox