From patchwork Mon Aug 5 07:39:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 57424 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 079021BE2A; Mon, 5 Aug 2019 09:40:34 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 6F6B431FC for ; Mon, 5 Aug 2019 09:40:32 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 00:39:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,349,1559545200"; d="scan'208";a="178775505" Received: from yexl-server.sh.intel.com ([10.67.117.5]) by orsmga006.jf.intel.com with ESMTP; 05 Aug 2019 00:39:49 -0700 From: Xiaolong Ye To: Qiming Yang , Wenzhuo Lu Cc: dev@dpdk.org, Xiaolong Ye , ying.a.wang@intel.com Date: Mon, 5 Aug 2019 15:39:23 +0800 Message-Id: <20190805073923.62812-1-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/ice: fix potential null pointer dereferences 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" This patch fixes two null pointer dereferences in flow code detected by coverity scan. Fixes: 94f00800d78b ("net/ice: fix VXLAN/NVGRE flow matching") Cc: ying.a.wang@intel.com Signed-off-by: Xiaolong Ye --- drivers/net/ice/ice_generic_flow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 5fcf4289c..1c0adc779 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -464,7 +464,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], "Invalid VXLAN item"); return 0; } - if (vxlan_mask->vni[0] == UINT8_MAX && + if (vxlan_mask && vxlan_mask->vni[0] == UINT8_MAX && vxlan_mask->vni[1] == UINT8_MAX && vxlan_mask->vni[2] == UINT8_MAX) input_set |= ICE_INSET_TUN_ID; @@ -486,7 +486,7 @@ static uint64_t ice_get_flow_field(const struct rte_flow_item pattern[], "Invalid NVGRE item"); return 0; } - if (nvgre_mask->tni[0] == UINT8_MAX && + if (nvgre_mask && nvgre_mask->tni[0] == UINT8_MAX && nvgre_mask->tni[1] == UINT8_MAX && nvgre_mask->tni[2] == UINT8_MAX) input_set |= ICE_INSET_TUN_ID;