2f7a6ced9011acb8e8a8690dd76d3f4463eaacd8
[openwrt/staging/rmilecki.git] /
1 From 97c5209b3d374a25ebdb4c2ea9e9c1b121768da0 Mon Sep 17 00:00:00 2001
2 From: Dan Carpenter <dan.carpenter@linaro.org>
3 Date: Wed, 14 Jun 2023 10:03:59 +0300
4 Subject: [PATCH] leds: trigger: netdev: uninitialized variable in
5 netdev_trig_activate()
6
7 The qca8k_cled_hw_control_get() function which implements ->hw_control_get
8 sets the appropriate bits but does not clear them. This leads to an
9 uninitialized variable bug. Fix this by setting mode to zero at the
10 start.
11
12 Fixes: e0256648c831 ("net: dsa: qca8k: implement hw_control ops")
13 Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
15 Acked-by: Lee Jones <lee@kernel.org>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 ---
18 drivers/leds/trigger/ledtrig-netdev.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21 --- a/drivers/leds/trigger/ledtrig-netdev.c
22 +++ b/drivers/leds/trigger/ledtrig-netdev.c
23 @@ -538,7 +538,7 @@ static void netdev_trig_work(struct work
24 static int netdev_trig_activate(struct led_classdev *led_cdev)
25 {
26 struct led_netdev_data *trigger_data;
27 - unsigned long mode;
28 + unsigned long mode = 0;
29 struct device *dev;
30 int rc;
31