diff options
| author | Haibo Chen <haibo.chen@nxp.com> | 2026-07-27 17:57:54 +0800 |
|---|---|---|
| committer | Lee Jones <lee@kernel.org> | 2026-09-22 13:30:31 +0100 |
| commit | 1b75f038e5f71ed32ce6593b5763f9776ec58a25 (patch) | |
| tree | 477d202b88046a78cb4c83140e210342061ea781 /tools/lib/python/kdoc/python_version.py | |
| parent | c73e9f04445f361d5f19ca2edfde742ce18348ef (diff) | |
leds: pca9532: Check i2c_smbus_read_byte_data() return value
Coverity report INTEGER_OVERFLOW (tainted_data_return ->
cast_underflow -> overflow) in pca9532_getled().
pca9532_getled() stored the return value of i2c_smbus_read_byte_data()
into a char and used it directly to compute the LED state without
checking for an error. i2c_smbus_read_byte_data() returns a negative
error code on failure. On an I2C read error the negative value was
assigned to an unsigned type, triggering an integer underflow/overflow,
and a meaningless LED state was returned to the caller.
Read the value into an int, check for the error, and fall back to
PCA9532_OFF while emitting a warning when the read fails.
Fixes: 28c5fe99016d ("leds: pca9532: Extend pca9532 device tree support")
Assisted-by: VeroCoder:vero-1 [cli]
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260727-led-fix-v1-1-d635c5037109@nxp.com
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
