Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 led] leds: trigger: netdev: uninitialized variable in netdev_trig_activate()
@ 2023-06-13  6:46 Dan Carpenter
  2023-06-14  0:51 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2023-06-13  6:46 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Pavel Machek, Lee Jones, Andrew Lunn, David S. Miller, linux-leds,
	kernel-janitors, netdev

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")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
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/5dff3719-f827-45b6-a0d3-a00efed1099b@moroto.mountain/
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(-)

diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index b0a6f2749552..2311dae7f070 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -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;
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 led] leds: trigger: netdev: uninitialized variable in netdev_trig_activate()
  2023-06-13  6:46 [PATCH v2 led] leds: trigger: netdev: uninitialized variable in netdev_trig_activate() Dan Carpenter
@ 2023-06-14  0:51 ` Andrew Lunn
  2023-06-14  6:45   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2023-06-14  0:51 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christian Marangi, Pavel Machek, Lee Jones, David S. Miller,
	linux-leds, kernel-janitors, netdev

On Tue, Jun 13, 2023 at 09:46:53AM +0300, Dan Carpenter 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> 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.

I think his actually needs to be merged via netdev.  e0256648c831
("net: dsa: qca8k: implement hw_control ops") is in net-next/main.  I
don't see it in leds/master, leds/for-leds-next. Also, git blame shows
mode was added by 0316cc5629d1 ("leds: trigger: netdev: init mode if
hw control already active") which also appears only to be in
net-next/main.

A lot of these LED patches were merged via netdev because they are
cross subsystem.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 led] leds: trigger: netdev: uninitialized variable in netdev_trig_activate()
  2023-06-14  0:51 ` Andrew Lunn
@ 2023-06-14  6:45   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-06-14  6:45 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Christian Marangi, Pavel Machek, Lee Jones, David S. Miller,
	linux-leds, kernel-janitors, netdev

On Wed, Jun 14, 2023 at 02:51:59AM +0200, Andrew Lunn wrote:
> I think his actually needs to be merged via netdev.  e0256648c831
> ("net: dsa: qca8k: implement hw_control ops") is in net-next/main.  I
> don't see it in leds/master, leds/for-leds-next. Also, git blame shows
> mode was added by 0316cc5629d1 ("leds: trigger: netdev: init mode if
> hw control already active") which also appears only to be in
> net-next/main.
> 
> A lot of these LED patches were merged via netdev because they are
> cross subsystem.

Ok.  Thanks, Andrew.

In that case, let me resend.  I just used get_maintainer.pl and it
didn't add the necessary CC list.  Plus the netdev scripts won't run if
you don't have the correct subject...

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-14  6:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-13  6:46 [PATCH v2 led] leds: trigger: netdev: uninitialized variable in netdev_trig_activate() Dan Carpenter
2023-06-14  0:51 ` Andrew Lunn
2023-06-14  6:45   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox