net: stmmac: fix off-by-one error in sanity check
Subsystems (4)
PATCH 1/1 net: stmmac: fix off-by-one error in sanity check
From: Arnd Bergmann <[email protected]>
My previous patch had an off-by-one error in the added sanity check, the arrays are MTL_MAX_{RX,TX}_QUEUES long, so if that index is that number, it has overflown.
The patch silenced the warning anyway because the strings could no longer overlap with the input, but they could still overlap with other fields.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -3502,7 +3502,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)/* Request Rx MSI irq */ for (i =0 ; i < priv->plat->rx_queues_to_use; i++) { -if (i >MTL_MAX_RX_QUEUES ) +if (i >=MTL_MAX_RX_QUEUES )break ;if (priv->rx_irq[i] ==0 )continue ;
@@ -3527,7 +3527,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)/* Request Tx MSI irq */ for (i =0 ; i < priv->plat->tx_queues_to_use; i++) { -if (i >MTL_MAX_TX_QUEUES ) +if (i >=MTL_MAX_TX_QUEUES )break ;if (priv->tx_irq[i] ==0 )continue ;
Signature · 1 line
2.29.2
This patch was applied to netdev/net-next.git (refs/heads/master):
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
Quoted 11 lines · On Mon, 27 Sep 2021 15:58:29 +0200 you wrote:
From: Arnd Bergmann <[email protected]>
My previous patch had an off-by-one error in the added sanity check, the arrays are MTL_MAX_{RX,TX}_QUEUES long, so if that index is that number, it has overflown.
The patch silenced the warning anyway because the strings could no longer overlap with the input, but they could still overlap with other fields.
[...]
Here is the summary with links:
- net: stmmac: fix off-by-one error in sanity check
https://git.kernel.org/netdev/net-next/c/d68c2e1d19c5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html