netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] stmmac: Fix incorrect dereference in stmmac_*_interrupt()
@ 2024-02-03 15:03 Pavel Sakharov
  2024-02-06 15:07 ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Sakharov @ 2024-02-03 15:03 UTC (permalink / raw)
  To: Alexandre Torgue
  Cc: Pavel Sakharov, Jose Abreu, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, lvc-project, Alexey Khoroshilov

If 'dev' is NULL, the 'priv' variable has an incorrect address when
dereferencing calling netdev_err().

Pass 'dev' instead of 'priv->dev" to the function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Pavel Sakharov <p.sakharov@ispras.ru>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 4727f7be4f86..5ab5148013cd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5848,7 +5848,7 @@ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id)
 	struct stmmac_priv *priv = netdev_priv(dev);

 	if (unlikely(!dev)) {
-		netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
+		netdev_err(dev, "%s: invalid dev pointer\n", __func__);
 		return IRQ_NONE;
 	}

@@ -5868,7 +5868,7 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id)
 	struct stmmac_priv *priv = netdev_priv(dev);

 	if (unlikely(!dev)) {
-		netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
+		netdev_err(dev, "%s: invalid dev pointer\n", __func__);
 		return IRQ_NONE;
 	}


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

end of thread, other threads:[~2024-02-17 18:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-03 15:03 [PATCH] stmmac: Fix incorrect dereference in stmmac_*_interrupt() Pavel Sakharov
2024-02-06 15:07 ` Simon Horman
2024-02-07 11:34   ` Serge Semin
2024-02-14  9:27   ` [PATCH net v2] net: stmmac: Fix incorrect dereference in interrupt handlers Pavel Sakharov
2024-02-16 18:39     ` Serge Semin
2024-02-17 18:50     ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).