Re: [PATCH 1/4] hwmon: (tps53679) Fix array access with zero-length block read
From: Guenter Roeck
Date: Sun Mar 29 2026 - 15:12:29 EST
On Sun, Mar 29, 2026 at 05:09:40PM +0000, Pradhan, Sanman wrote:
> From: Sanman Pradhan <psanman@xxxxxxxxxxx>
>
> i2c_smbus_read_block_data() can return 0, indicating a zero-length
> read. When this happens, tps53679_identify_chip() accesses buf[ret - 1]
> which is buf[-1], reading one byte before the buffer on the stack.
>
> Fix by changing the check from "ret < 0" to "ret <= 0", treating a
> zero-length read as an error (-EIO), which prevents the out-of-bounds
> array access.
>
> Also fix a typo in the adjacent comment: "if present" instead of
> duplicate "if".
>
> Fixes: 75ca1e5875fe ("hwmon: (pmbus/tps53679) Add support for TPS53685")
> Signed-off-by: Sanman Pradhan <psanman@xxxxxxxxxxx>
Applied.
Thanks,
Guenter