patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] raw/ifpga/base: check pointer before dereference
@ 2022-06-23  3:11 Wei Huang
  2022-06-23  5:51 ` Zhang, Tianfei
  2022-06-23  6:25 ` Xu, Rosen
  0 siblings, 2 replies; 4+ messages in thread
From: Wei Huang @ 2022-06-23  3:11 UTC (permalink / raw)
  To: dev, thomas, nipun.gupta, hemant.agrawal
  Cc: stable, rosen.xu, tianfei.zhang, qi.z.zhang, Wei Huang

Do null-checking on hw->adapter in fme_pmci_init() before dereference it.

Coverity issue: 379202
Fixes: ca6eb0f7c836 ("raw/ifpga/base: add PMCI base driver")

Signed-off-by: Wei Huang <wei.huang@intel.com>
---
 drivers/raw/ifpga/base/ifpga_fme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/raw/ifpga/base/ifpga_fme.c b/drivers/raw/ifpga/base/ifpga_fme.c
index 25ff819..b6dd4ce 100644
--- a/drivers/raw/ifpga/base/ifpga_fme.c
+++ b/drivers/raw/ifpga/base/ifpga_fme.c
@@ -1591,7 +1591,7 @@ static int fme_pmci_init(struct ifpga_feature *feature)
 	int ret = 0;
 
 	hw = fme->parent;
-	if (!hw)
+	if (!hw || !hw->adapter)
 		return -ENODEV;
 
 	mgr = hw->adapter->mgr;
@@ -1608,7 +1608,7 @@ static int fme_pmci_init(struct ifpga_feature *feature)
 
 	max10->type = M10_N6000;
 	max10->mmio = feature->addr;
-	if (hw->adapter && hw->adapter->shm.ptr) {
+	if (hw->adapter->shm.ptr) {
 		sd = (opae_share_data *)hw->adapter->shm.ptr;
 		max10->bmc_ops.mutex = &sd->spi_mutex;
 	} else {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-26 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23  3:11 [PATCH] raw/ifpga/base: check pointer before dereference Wei Huang
2022-06-23  5:51 ` Zhang, Tianfei
2022-06-26 10:21   ` Thomas Monjalon
2022-06-23  6:25 ` Xu, Rosen

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).