[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240625173350.1181194-2-sumang@marvell.com>
Date: Tue, 25 Jun 2024 23:03:43 +0530
From: Suman Ghosh <sumang@...vell.com>
To: <sgoutham@...vell.com>, <gakula@...vell.com>, <sbhatta@...vell.com>,
<hkelam@...vell.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lcherian@...vell.com>,
<jerinj@...vell.com>, <markus.elfring@....de>
CC: Suman Ghosh <sumang@...vell.com>
Subject: [net PATCH v2 1/7] octeontx2-af: Fix klockwork issue in cgx.c
Variable "cgx_dev" and "lmac" was getting accessed without NULL checks
which can lead to pointer exception in some erroneous scenarios.
This patch fixes the same by adding the required NULL checks.
Fixes: 96be2e0da85e ("octeontx2-af: Support for MAC address filters in CGX")
Signed-off-by: Suman Ghosh <sumang@...vell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 27935c54b91b..e5e266608cfc 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -465,6 +465,13 @@ u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)
u64 cfg;
int id;
+ if (!cgx_dev)
+ return 0;
+
+ lmac = lmac_pdata(lmac_id, cgx_dev);
+ if (!lmac)
+ return 0;
+
mac_ops = cgx_dev->mac_ops;
id = get_sequence_id_of_lmac(cgx_dev, lmac_id);
--
2.25.1
Powered by blists - more mailing lists