Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>, linux-hwmon@vger.kernel.org
Subject: Re: [RFT PATCH 1/3] hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126
Date: Tue, 10 Nov 2026 04:15:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-206182@kernel.org> (raw)
In-Reply-To: <20261110035955.3968731-2-linux@roeck-us.net>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] hwmon: (nct6775) REG_TARGET marked word-sized in
  nct6775_reg_is_word_sized()
--

commit 7460f66a45ab993c8409879e58f676a24f6e5ad1
Author: Guenter Roeck <linux@roeck-us.net>

hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126

This commit initializes target_temp_mask, tolerance_mask, and
speed_tolerance_limit for NCT6106, NCT6116, and NCT6126 in nct6775_probe().

Link: https://sashiko.dev/#/bug/linux-76f191d0-4c79-4982-887e-e5c9a2ed7136

> diff --git a/drivers/hwmon/nct6775-core.c b/drivers/hwmon/nct6775-core.c
> index 6e97e4f08b90b..9340525689cff 100644
> --- a/drivers/hwmon/nct6775-core.c
> +++ b/drivers/hwmon/nct6775-core.c
> @@ -3574,6 +3574,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;

[Severity: High]
Does setting target_temp_mask to 0xff expose that REG_TARGET (0x111, 0x121,
0x131, and 0x191, 0x1a1 on nct6116/nct6126) is marked word-sized in
nct6775_reg_is_word_sized()?

drivers/hwmon/nct6775-core.c:nct6775_reg_is_word_sized() {
	...
	case nct6106:
		return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
		  (reg >= 0x59 && reg < 0x69 && (reg & 1)) ||
		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 ||
		  reg == 0x111 || reg == 0x121 || reg == 0x131;
	case nct6116:
	case nct6126:
		return reg == 0x20 || reg == 0x22 || reg == 0x24 ||
		  reg == 0x26 || reg == 0x28 || reg == 0x59 || reg == 0x5b ||
		  reg == 0xe0 || reg == 0xe2 || reg == 0xe4 || reg == 0xe6 ||
		  reg == 0xe8 || reg == 0x111 || reg == 0x121 || reg == 0x131 ||
		  reg == 0x191 || reg == 0x1a1;
	...
}

Because nct6775_reg_is_word_sized() returns true for REG_TARGET, a read via
nct6775_read_value() performs a 16-bit big-endian read across REG_TARGET
(placed in bits 15:8) and the adjacent REG_TOLERANCE_H at reg + 1 (placed in
bits 7:0).  In nct6775_update_pwm_limits(), masking reg_t with
target_temp_mask (0xff) then discards REG_TARGET and stores REG_TOLERANCE_H
into data->target_temp[i], while also corrupting data->target_speed[i] in
speed_cruise mode.

When writing pwm*_target_temp in thermal_cruise mode, pwm_update_registers()
passes the 8-bit data->target_temp[nr] to nct6775_write_value(), which writes
0x00 (value >> 8) to REG_TARGET and overwrites REG_TOLERANCE_H with
target_temp[nr].  Should 0x111, 0x121, 0x131, 0x191, and 0x1a1 be removed from
nct6775_reg_is_word_sized()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110035955.3968731-1-linux@roeck-us.net?part=1

  reply	other threads:[~2026-11-10  4:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  3:59 [RFT PATCH 0/3] hwmon: (nct6775) Fix target temperature and tolerance handling Guenter Roeck
2026-11-10  3:59 ` [RFT PATCH 1/3] hwmon: (nct6775) Fix target temp and tolerance for NCT6106/6116/6126 Guenter Roeck
2026-11-10  4:15   ` sashiko-bot [this message]
2026-11-10  5:46     ` Guenter Roeck
2026-11-10  3:59 ` [RFT PATCH 2/3] hwmon: (nct6775) Fix swapped temperature tolerance register writes Guenter Roeck
2026-11-10  4:19   ` sashiko-bot
2026-11-10  3:59 ` [RFT PATCH 3/3] hwmon: (nct6775) Fix tolerance bitmask when reading REG_FAN_MODE Guenter Roeck
2026-11-10  4:26   ` sashiko-bot

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=sashiko-outbox-206182@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sashiko-reviews@lists.linux.dev \
    /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