From: Hongbo Zheng Date: Sun, 25 Apr 2021 12:58:16 +0000 (+0800) Subject: common/sfc_efx/base: fix dereferencing null pointer X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3de9af2aaa680b33a9a597b8ec4d76163dee2029;p=dpdk.git common/sfc_efx/base: fix dereferencing null pointer 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") Cc: stable@dpdk.org Signed-off-by: Hongbo Zheng Signed-off-by: Min Hu (Connor) Reviewed-by: Ferruh Yigit --- diff --git a/drivers/common/sfc_efx/base/efx_pci.c b/drivers/common/sfc_efx/base/efx_pci.c index 8a26da68a9..9c7cacbdec 100644 --- a/drivers/common/sfc_efx/base/efx_pci.c +++ b/drivers/common/sfc_efx/base/efx_pci.c @@ -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.