diff options
author | Alexander Grund <flamefire89@gmail.com> | 2024-01-01 20:22:58 +0100 |
---|---|---|
committer | Alexander Grund <flamefire89@gmail.com> | 2024-01-01 20:22:58 +0100 |
commit | 31d4916af0989535bc16e7015eaaf1bd0c7450b6 (patch) | |
tree | 1ba128079cbf60a8c7436b9bbb6b04f8a14045ed | |
parent | 2940437216a5097c20ff7a4aa9084b14fd7e29bc (diff) |
leds: leds-qpnp: Fix uninitialized local variable
rgb_blink_store searches through rgb_sync->led_data for a valid entry
and bails out if none was found, i.e. `!led`.
However that variable is not set to NULL before the loop and might point
to random memory.
Fix by setting it to NULL in the declaration.
Change-Id: Ideb16c47defc6a5fd466d96a2a854ad83acf3651
-rw-r--r-- | drivers/leds/leds-qpnp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/leds/leds-qpnp.c b/drivers/leds/leds-qpnp.c index deec2c4e246a..0eec6d0f52d4 100644 --- a/drivers/leds/leds-qpnp.c +++ b/drivers/leds/leds-qpnp.c @@ -2819,7 +2819,7 @@ static ssize_t rgb_blink_store(struct device *dev, const char *buf, size_t count) { struct rgb_sync *rgb_sync; - struct qpnp_led_data *led; + struct qpnp_led_data *led = NULL; unsigned long blinking; struct led_classdev *led_cdev = dev_get_drvdata(dev); ssize_t rc = -EINVAL, i; |