kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
@ 2024-04-23 16:15 Dan Carpenter
  2024-04-24  7:27 ` Roger Quadros
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-04-23 16:15 UTC (permalink / raw)
  To: Roger Quadros
  Cc: MD Danish Anwar, Roger Quadros, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andrew Lunn, Jan Kiszka, Diogo Ivo,
	Rob Herring, Grygorii Strashko, Vignesh Raghavendra,
	linux-arm-kernel, netdev, linux-kernel, kernel-janitors

The rx_chn->irq[] array is unsigned int but it should be signed for the
error handling to work.  Also if k3_udma_glue_rx_get_irq() returns zero
then we should return -ENXIO instead of success.

Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
I had previously fixed the issues with the tx_chns() version of this but
I didn't realize there was an rx version.  These functions got moved
around in net-next so that's why I noticed this bug...  Moving the
code around makes applying this to net-next kind of pain.

 drivers/net/ethernet/ti/icssg/icssg_prueth.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index cf7b73f8f450..b69af69a1ccd 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -421,12 +421,14 @@ static int prueth_init_rx_chns(struct prueth_emac *emac,
 		if (!i)
 			fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
 								     i);
-		rx_chn->irq[i] = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
-		if (rx_chn->irq[i] <= 0) {
-			ret = rx_chn->irq[i];
+		ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
+		if (ret <= 0) {
+			if (!ret)
+				ret = -ENXIO;
 			netdev_err(ndev, "Failed to get rx dma irq");
 			goto fail;
 		}
+		rx_chn->irq[i] = ret;
 	}
 
 	return 0;
-- 
2.43.0


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

* Re: [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
  2024-04-23 16:15 [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns() Dan Carpenter
@ 2024-04-24  7:27 ` Roger Quadros
  2024-04-24  8:28 ` MD Danish Anwar
  2024-04-25 15:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Quadros @ 2024-04-24  7:27 UTC (permalink / raw)
  To: Dan Carpenter, Roger Quadros
  Cc: MD Danish Anwar, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Jan Kiszka, Diogo Ivo, Rob Herring,
	Grygorii Strashko, Vignesh Raghavendra, linux-arm-kernel, netdev,
	linux-kernel, kernel-janitors



On 23/04/2024 19:15, Dan Carpenter wrote:
> The rx_chn->irq[] array is unsigned int but it should be signed for the
> error handling to work.  Also if k3_udma_glue_rx_get_irq() returns zero
> then we should return -ENXIO instead of success.
> 
> Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Roger Quadros <rogerq@kernel.org>

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

* Re: [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
  2024-04-23 16:15 [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns() Dan Carpenter
  2024-04-24  7:27 ` Roger Quadros
@ 2024-04-24  8:28 ` MD Danish Anwar
  2024-04-25 15:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: MD Danish Anwar @ 2024-04-24  8:28 UTC (permalink / raw)
  To: Dan Carpenter, Roger Quadros
  Cc: Roger Quadros, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Jan Kiszka, Diogo Ivo, Rob Herring,
	Grygorii Strashko, Vignesh Raghavendra, linux-arm-kernel, netdev,
	linux-kernel, kernel-janitors



On 23/04/24 9:45 pm, Dan Carpenter wrote:
> The rx_chn->irq[] array is unsigned int but it should be signed for the
> error handling to work.  Also if k3_udma_glue_rx_get_irq() returns zero
> then we should return -ENXIO instead of success.
> 
> Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: MD Danish Anwar <danishanwar@ti.com>

-- 
Thanks and Regards,
Danish

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

* Re: [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
  2024-04-23 16:15 [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns() Dan Carpenter
  2024-04-24  7:27 ` Roger Quadros
  2024-04-24  8:28 ` MD Danish Anwar
@ 2024-04-25 15:30 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-25 15:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: rogerq, danishanwar, rogerq, davem, edumazet, kuba, pabeni,
	andrew, jan.kiszka, diogo.ivo, robh, grygorii.strashko, vigneshr,
	linux-arm-kernel, netdev, linux-kernel, kernel-janitors

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 23 Apr 2024 19:15:22 +0300 you wrote:
> The rx_chn->irq[] array is unsigned int but it should be signed for the
> error handling to work.  Also if k3_udma_glue_rx_get_irq() returns zero
> then we should return -ENXIO instead of success.
> 
> Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> [...]

Here is the summary with links:
  - [net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
    https://git.kernel.org/netdev/net/c/4dcd0e83ea1d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-04-25 15:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 16:15 [PATCH net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns() Dan Carpenter
2024-04-24  7:27 ` Roger Quadros
2024-04-24  8:28 ` MD Danish Anwar
2024-04-25 15:30 ` 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).