From patchwork Thu May 23 02:53:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pei, Andy" X-Patchwork-Id: 53629 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 273621B945; Thu, 23 May 2019 04:58:56 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 2FF5725D9; Thu, 23 May 2019 04:58:55 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 19:58:54 -0700 X-ExtLoop1: 1 Received: from dipei-st-npg.sh.intel.com ([10.67.110.220]) by fmsmga007.fm.intel.com with ESMTP; 22 May 2019 19:58:53 -0700 From: Andy Pei To: dev@dpdk.org Cc: andy.pei@intel.com, rosen.xu@intel.com, stable@dpdk.org Date: Thu, 23 May 2019 10:53:03 +0800 Message-Id: <1558579983-142573-1-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1558509691-429834-1-git-send-email-andy.pei@intel.com> References: <1558509691-429834-1-git-send-email-andy.pei@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ipn3ke: check input argument before other operation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" check input argument rte_eth_dev *ethdev, ensuring ethdev is not NULL before operation on ethdev. Coverity issue: 337922 Fixes: 70d6b7f550f4 ("net/ipn3ke: add representor") Cc: rosen.xu@intel.com Cc: stable@dpdk.org Signed-off-by: Andy Pei Acked-by: Rosen Xu --- drivers/net/ipn3ke/ipn3ke_representor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index cf3b214..f7bb0b4 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -735,13 +735,16 @@ enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg) { - struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev); - struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); int ret = 0; + struct ipn3ke_hw *hw; + struct ipn3ke_rpst *rpst; if (ethdev == NULL) return -EINVAL; + hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev); + rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); + if (hw->acc_flow) switch (filter_type) { case RTE_ETH_FILTER_GENERIC: