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 B24F3A00C2 for ; Wed, 17 Mar 2021 09:21:34 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FEA7242BA4; Wed, 17 Mar 2021 09:21:34 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 1DE9A242BA1; Wed, 17 Mar 2021 09:21:31 +0100 (CET) IronPort-SDR: d4BtLmVzQ2BWhudgnyD+UXgXRaabfpB8sqN08+A+t95UY3F8QsGwddgW3P7uGIf3KWY1NgNatj /j9xNuE556Yg== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="274463938" X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="274463938" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 01:21:31 -0700 IronPort-SDR: MdlDyPXNNscdwfqKU0uh9o8XTqP7RDY4w0IuL+cuMUv2HqHHm1UEy5ONlHJJwM2DdcJojxKkUz i5kyR4lmm2DA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="602144391" Received: from unknown (HELO sh_lab5_1.sh.intel.com) ([10.238.175.190]) by fmsmga006.fm.intel.com with ESMTP; 17 Mar 2021 01:21:29 -0700 From: Wei Huang To: dev@dpdk.org, rosen.xu@intel.com, qi.z.zhang@intel.com Cc: stable@dpdk.org, tianfei.zhang@intel.com, Wei Huang Date: Wed, 17 Mar 2021 04:21:36 -0400 Message-Id: <1615969296-17021-5-git-send-email-wei.huang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615969296-17021-1-git-send-email-wei.huang@intel.com> References: <1615969296-17021-1-git-send-email-wei.huang@intel.com> Subject: [dpdk-stable] [PATCH v1 4/4] raw/ifpga/base: check pointer before dereferencing 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 Sender: "stable" In init_sec_mgr(), pointer "hw" may be NULL, so "hw" should be checked before dereferencing. Coverity issue: 367483 Fixes: 7a4f3993f269 ("raw/ifpga: add FPGA RSU APIs") Signed-off-by: Wei Huang --- drivers/raw/ifpga/base/ifpga_sec_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/raw/ifpga/base/ifpga_sec_mgr.c b/drivers/raw/ifpga/base/ifpga_sec_mgr.c index 4cf1db3049..15fb5b6d4d 100644 --- a/drivers/raw/ifpga/base/ifpga_sec_mgr.c +++ b/drivers/raw/ifpga/base/ifpga_sec_mgr.c @@ -610,7 +610,7 @@ int init_sec_mgr(struct ifpga_fme_hw *fme) smgr->rsu_status = NULL; } - if ((hw->pci_data->device_id == IFPGA_N3000_DID) && + if (hw && (hw->pci_data->device_id == IFPGA_N3000_DID) && (hw->pci_data->vendor_id == IFPGA_N3000_VID)) { smgr->ops = &n3000_sec_ops; smgr->copy_speed = IFPGA_N3000_COPY_SPEED; -- 2.29.2