Skip to contentSkip to conversation

leds: trigger: netdev: uninitialized variable in netdev_trig_activate()

PATCH RESEND Applied Dan Carpenter 3 participants 3 messages Jun 14, 2023 – Jun 15, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 leds: trigger: netdev: uninitialized variable in netdev_trig_activate()

The qca8k_cled_hw_control_get() function which implements ->hw_control_get sets the appropriate bits but does not clear them. This leads to an uninitialized variable bug. Fix this by setting mode to zero at the start.

Fixes e0256648c831 ("net: dsa: qca8k: implement hw_control ops")

---
Resending because this actually goes through net-next and not the led subsystem.

v2: In the original patch I fixed qca8k_cled_hw_control_get() instead so that patch went to netdev instead of to the led subsystem.
https://lore.kernel.org/all/[email protected]/
Fixing it here is a more reliable way to do it.

 drivers/leds/trigger/ledtrig-netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/trigger/ledtrig-netdev.c +1 -1
index b0a6f2749552..2311dae7f070 100644
@@ -445,7 +445,7 @@ static void netdev_trig_work(struct work_struct *work)
 static int netdev_trig_activate(struct led_classdev *led_cdev)
 {
 	struct led_netdev_data *trigger_data;
-	unsigned long mode;
+	unsigned long mode = 0;
 	struct device *dev;
 	int rc;
 
Signature · 1 line
2.39.2
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 12 lines · Dan Carpenter

The qca8k_cled_hw_control_get() function which implements ->hw_control_get sets the appropriate bits but does not clear them. This leads to an uninitialized variable bug. Fix this by setting mode to zero at the start.

Fixes e0256648c831 ("net: dsa: qca8k: implement hw_control ops")

---
Resending because this actually goes through net-next and not the led subsystem.

Quoted 7 lines

v2: In the original patch I fixed qca8k_cled_hw_control_get() instead so that patch went to netdev instead of to the led subsystem.
https://lore.kernel.org/all/[email protected]/
Fixing it here is a more reliable way to do it.

 drivers/leds/trigger/ledtrig-netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
Lee Jones [李琼斯]
#2 lore raw
In reply to Dan Carpenter
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 10 lines · On Wed, 14 Jun 2023 10:03:59 +0300 you wrote:

The qca8k_cled_hw_control_get() function which implements ->hw_control_get sets the appropriate bits but does not clear them. This leads to an uninitialized variable bug. Fix this by setting mode to zero at the start.

Fixes e0256648c831 ("net: dsa: qca8k: implement hw_control ops")

[...]

Here is the summary with links:
- [v2,net-next,resend] leds: trigger: netdev: uninitialized variable in netdev_trig_activate()

    https://git.kernel.org/netdev/net-next/c/97c5209b3d37

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html