From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 295E4A0545 for ; Thu, 23 Jun 2022 05:03:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 231334069C; Thu, 23 Jun 2022 05:03:30 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 9364F4069C; Thu, 23 Jun 2022 05:03:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655953407; x=1687489407; h=from:to:cc:subject:date:message-id; bh=17u+qXs3a17YKCb40Ulye0GQDAgGfD8Qb3phMsk9Tng=; b=XjgCn811XRwSD+YyrpP31vqPrY65H6V1FC8qm1oBwBK2s8VHe38ud6zt 27Oq0a8k9igQlxwauNMenhOoXIvhWlSO04MMpujb154cyJ8zVYM1tPe87 sMhjbXIY/li9O7PqxblHQvZvMRkyrDgxLDX2PpW/QmUPTM+7ad7xIL6vd 9kPYCgV7lPF/oP6OAGVTcBPDqExE7TcnBGp2u0GKX39AZ8/SA3G/2VKig jjPoidmgpZffQ7I+0w5Fm716c37LcbD2dIoXqXRJ4ERUQWMnbWVZZt3Q5 Je7GnEinDbH5LdchFMPgE1gWAHOEhn55RJRpHyggddsA6+0+2bdyQYNLm g==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="261041485" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="261041485" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 20:03:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="677865701" Received: from unknown (HELO zj-fpga-amt.sh.intel.com) ([10.238.175.102]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 20:03:24 -0700 From: Wei Huang To: dev@dpdk.org, thomas@monjalon.net, nipun.gupta@nxp.com, hemant.agrawal@nxp.com Cc: stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com, qi.z.zhang@intel.com, Wei Huang Subject: [PATCH] raw/ifpga/base: check pointer before dereference Date: Wed, 22 Jun 2022 23:11:30 -0400 Message-Id: <1655953890-26163-1-git-send-email-wei.huang@intel.com> X-Mailer: git-send-email 1.8.3.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 --- 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