Skip to contentSkip to conversation

common/sfc_efx/base: fix the problem of using null pointer

PATCH Applied Min Hu (Connor) 2 participants 2 messages Apr 25, 2021 – Apr 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/sfc_efx/base: fix the problem of using null pointer

From: HongBo Zheng <[email protected]>

In function efx_pci_xilinx_cap_tbl_find, pointer entry_offsetp is used before null pointer check, which may cause access to null pointer.

This patch fix this problem.

Fixes ba9568b8b4b7 ("common/sfc_efx/base: add Xilinx capabilities table lookup")
---
 drivers/common/sfc_efx/base/efx_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_pci.c +2 -1
index 8a26da6..9c7cacb 100644
@@ -310,7 +310,7 @@ efx_pci_xilinx_cap_tbl_find(
 	__in				boolean_t skip_first,
 	__inout				efsys_dma_addr_t *entry_offsetp)
 {
-	efsys_dma_addr_t offset = *entry_offsetp;
+	efsys_dma_addr_t offset;
 	boolean_t skip = skip_first;
 	efx_qword_t header;
 	uint32_t format;
@@ -322,6 +322,7 @@ efx_pci_xilinx_cap_tbl_find(
 		goto fail1;
 	}
 
+	offset = *entry_offsetp;
 	rc = ENOENT;
 	/*
 	 * SF-119689-TC Riverhead Host Interface section 4.2.2.
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1 Applied
#1 lore raw
Quoted 5 lines · Min Hu (Connor)

From: HongBo Zheng <[email protected]>

In function efx_pci_xilinx_cap_tbl_find, pointer entry_offsetp is used before null pointer check, which may cause access to null pointer.

Quoted 7 lines

This patch fix this problem.

Fixes ba9568b8b4b7 ("common/sfc_efx/base: add Xilinx capabilities table lookup")

Applied to dpdk-next-net/main, thanks.