From patchwork Sun Apr 25 12:58:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "humin (Q)" X-Patchwork-Id: 92129 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 772B5A0548; Sun, 25 Apr 2021 14:58:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0246141139; Sun, 25 Apr 2021 14:58:13 +0200 (CEST) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 624C44110A for ; Sun, 25 Apr 2021 14:58:11 +0200 (CEST) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FSp073mSDzpbgH for ; Sun, 25 Apr 2021 20:55:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Sun, 25 Apr 2021 20:58:06 +0800 From: "Min Hu (Connor)" To: CC: , Date: Sun, 25 Apr 2021 20:58:16 +0800 Message-ID: <1619355496-15057-1-git-send-email-humin29@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] common/sfc_efx/base: fix the problem of using null pointer X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: HongBo Zheng 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 --- drivers/common/sfc_efx/base/efx_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/common/sfc_efx/base/efx_pci.c b/drivers/common/sfc_efx/base/efx_pci.c index 8a26da6..9c7cacb 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.