[PATCH net-next] net: ethernet: ti: am65-cpsw: Fix uninitialized variable

Dan Carpenter posted 1 patch 1 month, 1 week ago
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 +
1 files changed, 1 insertion(+)
[PATCH net-next] net: ethernet: ti: am65-cpsw: Fix uninitialized variable
Posted by Dan Carpenter 1 month, 1 week ago
The *ndev pointer needs to be set or it leads to an uninitialized variable
bug in the caller.

Fixes: 4a7b2ba94a59 ("net: ethernet: ti: am65-cpsw: Use tstats instead of open coded version")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 1 +
 1 files changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index cda7ddfe6845..fe1f2fa0ff9c 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1341,6 +1341,7 @@ am65_cpsw_nuss_tx_compl_packet_xdp(struct am65_cpsw_common *common,
 
 	port = am65_common_get_port(common, port_id);
 	dev_sw_netstats_tx_add(port->ndev, 1, xdpf->len);
+	*ndev = port->ndev;
 
 	return xdpf;
 }
Re: [PATCH net-next] net: ethernet: ti: am65-cpsw: Fix uninitialized variable
Posted by Roger Quadros 1 month, 1 week ago

On 16/10/2024 17:41, Dan Carpenter wrote:
> The *ndev pointer needs to be set or it leads to an uninitialized variable
> bug in the caller.
> 
> Fixes: 4a7b2ba94a59 ("net: ethernet: ti: am65-cpsw: Use tstats instead of open coded version")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thanks Dan for this fix!

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