diff options
| author | Sanman Pradhan <psanman@juniper.net> | 2026-03-30 15:56:40 +0000 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-03-30 10:46:53 -0700 |
| commit | ca34ee6d0307a0b4e52c870dfc1bb8a3c3eb956e (patch) | |
| tree | c1ccfd74d91cb7668ffc8f4b81df0162cbbc62ad /include/asm-frv/git@git.tavy.me:linux.git | |
| parent | a9d2fbd3ad0e6ac588386e699beeccfe7516755f (diff) | |
hwmon: (tps53679) Fix device ID comparison and printing in tps53676_identify()
tps53676_identify() uses strncmp() to compare the device ID buffer
against a byte sequence containing embedded non-printable bytes
(\x53\x67\x60). strncmp() is semantically wrong for binary data
comparison; use memcmp() instead.
Additionally, the buffer from i2c_smbus_read_block_data() is not
NUL-terminated, so printing it with "%s" in the error path is
undefined behavior and may read past the buffer. Use "%*ph" to
hex-dump the actual bytes returned.
Per the datasheet, the expected device ID is the 6-byte sequence
54 49 53 67 60 00 ("TI\x53\x67\x60\x00"), so compare all 6 bytes
including the trailing NUL.
Fixes: cb3d37b59012 ("hwmon: (pmbus/tps53679) Add support for TI TPS53676")
Signed-off-by: Sanman Pradhan <psanman@juniper.net>
Link: https://lore.kernel.org/r/20260330155618.77403-1-sanman.pradhan@hpe.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'include/asm-frv/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
