From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 527B6C433FE for ; Wed, 13 Oct 2021 02:49:55 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 1A22660F23 for ; Wed, 13 Oct 2021 02:49:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1A22660F23 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5255A410FA; Wed, 13 Oct 2021 04:49:53 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id D227C410DA; Wed, 13 Oct 2021 04:49:51 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10135"; a="214481458" X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="214481458" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2021 19:49:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,369,1624345200"; d="scan'208";a="441471852" Received: from dpdk-junfengguo-v1.sh.intel.com ([10.67.119.231]) by orsmga006.jf.intel.com with ESMTP; 12 Oct 2021 19:49:49 -0700 From: Junfeng Guo To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, stable@dpdk.org, ferruh.yigit@intel.com, junfeng.guo@intel.com Date: Wed, 13 Oct 2021 10:34:55 +0000 Message-Id: <20211013103455.3256151-1-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/ice/base: fix null pointer dereferences for parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Null-checking "p" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Thus correct the code lines and remove the redundant line. Fixes: c84f8aa2100c ("net/ice/base: add parser runtime skeleton") Cc: stable@dpdk.org Signed-off-by: Junfeng Guo --- drivers/net/ice/base/ice_parser.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ice/base/ice_parser.c b/drivers/net/ice/base/ice_parser.c index 690004e6e2..9b106baff0 100644 --- a/drivers/net/ice/base/ice_parser.c +++ b/drivers/net/ice/base/ice_parser.c @@ -167,13 +167,11 @@ enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) struct ice_parser *p; p = (struct ice_parser *)ice_malloc(hw, sizeof(struct ice_parser)); - p->hw = hw; - p->rt.psr = p; - if (!p) return ICE_ERR_NO_MEMORY; p->hw = hw; + p->rt.psr = p; p->imem_table = ice_imem_table_get(hw); if (!p->imem_table) { -- 2.25.1