DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <andrew.rybchenko@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH] common/sfc_efx/base: fix the problem of using null pointer
Date: Sun, 25 Apr 2021 20:58:16 +0800	[thread overview]
Message-ID: <1619355496-15057-1-git-send-email-humin29@huawei.com> (raw)

From: HongBo Zheng <zhenghongbo3@huawei.com>

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 <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 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.
-- 
2.7.4


             reply	other threads:[~2021-04-25 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-25 12:58 Min Hu (Connor) [this message]
2021-04-27 15:23 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1619355496-15057-1-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).