* [PATCH net-next] net: airoha: Fix forever loops in error handling
@ 2024-07-18 18:32 Dan Carpenter
2024-07-18 19:39 ` Lorenzo Bianconi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-07-18 18:32 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Felix Fietkau, Sean Wang, Mark Lee, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, linux-mediatek, netdev,
kernel-janitors
These loops have ++ where -- was intended. It would end up looping until
the system died.
Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
index 7967a92803c2..698835dc6da0 100644
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
@@ -977,7 +977,7 @@ static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable)
return 0;
error:
- for (i--; i >= 0; i++)
+ while (--i >= 0)
airoha_set_gdm_port(eth, port_list[i], false);
return err;
@@ -2431,7 +2431,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
error_unmap:
- for (i--; i >= 0; i++)
+ while (--i >= 0)
dma_unmap_single(dev->dev.parent, q->entry[i].dma_addr,
q->entry[i].dma_len, DMA_TO_DEVICE);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: airoha: Fix forever loops in error handling
2024-07-18 18:32 [PATCH net-next] net: airoha: Fix forever loops in error handling Dan Carpenter
@ 2024-07-18 19:39 ` Lorenzo Bianconi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2024-07-18 19:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: Felix Fietkau, Sean Wang, Mark Lee, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, linux-mediatek, netdev,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]
> These loops have ++ where -- was intended. It would end up looping until
> the system died.
Hi Dan,
I have already posted a fix for it:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=1f038d5897fe6b439039fc28420842abcc0d126b
Regards,
Lorenzo
>
> Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
> index 7967a92803c2..698835dc6da0 100644
> --- a/drivers/net/ethernet/mediatek/airoha_eth.c
> +++ b/drivers/net/ethernet/mediatek/airoha_eth.c
> @@ -977,7 +977,7 @@ static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable)
> return 0;
>
> error:
> - for (i--; i >= 0; i++)
> + while (--i >= 0)
> airoha_set_gdm_port(eth, port_list[i], false);
>
> return err;
> @@ -2431,7 +2431,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
> return NETDEV_TX_OK;
>
> error_unmap:
> - for (i--; i >= 0; i++)
> + while (--i >= 0)
> dma_unmap_single(dev->dev.parent, q->entry[i].dma_addr,
> q->entry[i].dma_len, DMA_TO_DEVICE);
>
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-18 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-18 18:32 [PATCH net-next] net: airoha: Fix forever loops in error handling Dan Carpenter
2024-07-18 19:39 ` Lorenzo Bianconi
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).