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 7069F4243B; Fri, 20 Jan 2023 21:56:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ADCCE42D3D; Fri, 20 Jan 2023 21:55:56 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 4439A4067E for ; Fri, 20 Jan 2023 21:55:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674248154; x=1705784154; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qNCjoDDV3ABfjM+tFa9w3i5K7xXF1awGJKDAlNtf7DE=; b=EmiEvW4d70fqjxCEt6C7Cb5B2IJuULqE0C+DKtLeDsXoE/5SeM31fYki Z/mV8c0yPSOcX+sOxrv7szC+N/tPArLyB5R3S7d5gr3CEXt915U6CM3D4 6v6MEoMfg6vtj6yOpC15XdCgOKGdp9p2BMrVldVE91x+WFzZhkyr4XUFN yQd0/4yK0MsbvZVIfp/AzvWKSf12OickaKO8Hs4ND5tWz7vQkSWIkJxrb DG/0xWiEoWcWQ4eCLup9P0mq/a8z+T6/sOMvPeWAalwxZWIYJ/9+GytXx YjV7xQxHwyhofMewdpGBAfpTzpXalsTUSsHJ2/f1HeUf+qahOPXZ7Gx3t w==; X-IronPort-AV: E=McAfee;i="6500,9779,10596"; a="326964558" X-IronPort-AV: E=Sophos;i="5.97,233,1669104000"; d="scan'208";a="326964558" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2023 12:55:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10596"; a="989527240" X-IronPort-AV: E=Sophos;i="5.97,233,1669104000"; d="scan'208";a="989527240" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by fmsmga005.fm.intel.com with ESMTP; 20 Jan 2023 12:55:52 -0800 From: Hernan Vargas To: dev@dpdk.org, maxime.coquelin@redhat.com, gakhil@marvell.com, trix@redhat.com Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com, john.mcnamara@intel.com, Hernan Vargas Subject: [PATCH v1 1/1] baseband/acc: fix check after deref and dead code Date: Fri, 20 Jan 2023 12:55:53 -0800 Message-Id: <20230120205553.62419-2-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230120205553.62419-1-hernan.vargas@intel.com> References: <20230120205553.62419-1-hernan.vargas@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Fix potential issue of dereferencing a pointer before null check. Remove null check for value that could never be null. Coverity issue: 381646, 381631 Fixes: 989dec301a9 ("baseband/acc100: add ring companion address") Signed-off-by: Hernan Vargas --- drivers/baseband/acc/rte_acc100_pmd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index 0992cb5d1e..a600511f4b 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -4106,12 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, int ret, cbm; struct rte_bbdev_enc_op *op; - if (q == NULL) - return 0; -#ifdef RTE_LIBRTE_BBDEV_DEBUG - if (unlikely(ops == 0)) + if (avail == 0) return 0; -#endif + op = acc_op_tail(q, 0); if (unlikely(ops == NULL || op == NULL)) return 0; -- 2.37.1