Re: [hwmon PATCH v2 8/8] hwmon: (adt7470) Fix PWM auto temp state array and bounds check

Guenter Roeck <[email protected]> Mon, 27 Jul 2026 17:58:52 -0700
Newsgroups org.kernel.vger.linux-hwmon,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Mon, Jul 27, 2026 at 09:22:24PM -0300, Luiz Angelo Daros de Luca wrote:
> In pwm_auto_temp_store(), the parsed user input was missing bounds
> checks, allowing values > 0xF to overflow into the adjacent channel's
> bits. Furthermore, the value was being incorrectly written to the
> pwm_automatic state array instead of pwm_auto_temp.
> 
> Fix this by rejecting values > 0xF with -EINVAL, and assigning the
> value to the correct array only after a successful I2C write.
> 
> Reported-by: [email protected]
> Closes: https://lore.kernel.org/all/[email protected]/#t
> Fixes: 6f9703d0be16 ("hwmon: add support for adt7470")
> Signed-off-by: Luiz Angelo Daros de Luca <[email protected]>

Applied.

Thanks,
Guenter