Skip to contentSkip to conversation

net: sched: avoid printing uninitialized link speed

PATCH Applied Jakub Kicinski 2 participants 2 messages Jun 9 – Jun 11

Subsystems (4)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 net: sched: avoid printing uninitialized link speed

sch_cbs and sch_taprio print ecmd.base.speed, even if netif_get_link_ksettings() failed. When netif_get_link_ksettings() fails the ecmd may not be initialized.

Use the always-initialized speed variable instead. The semantics change slightly because UNKNOWN will never be printed, but that doesn't seem important enough to complicate the code for.

This is a _dbg() print, anyway.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 net/sched/sch_cbs.c    | 2 +-
 net/sched/sch_taprio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
net/sched/sch_cbs.c +1 -1
index 85b41ffc63ff..1c93469c56e3 100644
@@ -340,7 +340,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q)
 	atomic64_set(&q->port_rate, port_rate);
 	netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n",
 		   dev->name, (long long)atomic64_read(&q->port_rate),
-		   ecmd.base.speed);
+		   speed);
 }
 
 static int cbs_dev_notifier(struct notifier_block *nb, unsigned long event,
net/sched/sch_taprio.c +1 -1
index e83cbce62a54..558987d9b977 100644
@@ -1321,7 +1321,7 @@ static void taprio_set_picos_per_byte(struct net_device *dev,
 	atomic64_set(&q->picos_per_byte, picos_per_byte);
 	netdev_dbg(dev, "taprio: set %s's picos_per_byte to: %lld, linkspeed: %d\n",
 		   dev->name, (long long)atomic64_read(&q->picos_per_byte),
-		   ecmd.base.speed);
+		   speed);
 }
 
 static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
Signature · 1 line
2.54.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

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

Quoted 10 lines · On Tue, 9 Jun 2026 11:33:53 -0700 you wrote:

sch_cbs and sch_taprio print ecmd.base.speed, even if netif_get_link_ksettings() failed. When netif_get_link_ksettings() fails the ecmd may not be initialized.

Use the always-initialized speed variable instead. The semantics change slightly because UNKNOWN will never be printed, but that doesn't seem important enough to complicate the code for.

[...]

Here is the summary with links:
- [net-next] net: sched: avoid printing uninitialized link speed

    https://git.kernel.org/netdev/net-next/c/518d8d019953

You are awesome, thank you!

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