diff options
| author | Maarten Zanders <[email protected]> | 2022-10-28 10:56:43 +0000 |
|---|---|---|
| committer | Pavel Machek <[email protected]> | 2022-10-28 15:12:27 +0000 |
| commit | 17c13c724b143c835fe3a9109daab524dff3d06f (patch) | |
| tree | 9fb8e63338d2384b371251ad00c21fd9956e559c /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |
| parent | dt-bindings: leds: Add 'cpuX' to 'linux,default-trigger' (diff) | |
| download | kernel-17c13c724b143c835fe3a9109daab524dff3d06f.tar.gz kernel-17c13c724b143c835fe3a9109daab524dff3d06f.zip | |
leds: lp5523: fix out-of-bounds bug in lp5523_selftest()
When not all LED channels of the led chip are configured, the
sysfs selftest functionality gives erroneous results and tries to
test all channels of the chip.
There is a potential for LED overcurrent conditions since the
test current will be set to values from out-of-bound regions.
It is wrong to use pdata->led_config[i].led_current to skip absent
channels as led_config[] only contains the configured LED channels.
Instead of iterating over all the physical channels of the device,
loop over the available LED configurations and use led->chan_nr to
access the correct i2c registers. Keep the zero-check for the LED
current as existing users might depend on this to disable a channel.
Reported-by: Arne Staessen <[email protected]>
Signed-off-by: Maarten Zanders <[email protected]>
Signed-off-by: Pavel Machek <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
0 files changed, 0 insertions, 0 deletions
