From patchwork Wed Feb 22 16:40:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hernan Vargas X-Patchwork-Id: 124401 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 15FDB41D40; Wed, 22 Feb 2023 17:40:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7CBA43135; Wed, 22 Feb 2023 17:40:38 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id BFB074302F; Wed, 22 Feb 2023 17:40:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677084035; x=1708620035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M+0La1tNhx591dMMPpefF7MJsd+nDUrH4JLjBCTUA6c=; b=V2M+srXRtVRhC5GYg3YUdaxjgMIlGEDm1LCBOG/JjIvHqiEFFvULby1p IkhlsEKAbXwN+v+7y1Sc5RQJIXk9yPQgkMs+l0Qde1IjMPITfqk5a5tiC vC+e+yrTPz5EEe50TS6iSerYzq5QzAc9hoNE+pHRhouwEz/wWjrfvLj5C wtN/n2i9dx2/4P3G2/sVazIW6gyhVoavNwxQSYGmW4c0tieelm+8q0AXx dBIpvlWck766qFSq2KIVqJe101i+rAFD5nju25p/5/QEK3T4JZzdAkE1j s88l+viAUZl8RYzRpvUMh1X3n75kc6X7QukS7IRr9EbnJrilfcOZlm12W A==; X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="332973494" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="332973494" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2023 08:40:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="781504533" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="781504533" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by fmsmga002.fm.intel.com with ESMTP; 22 Feb 2023 08:40:33 -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 , stable@dpdk.org Subject: [PATCH v3 1/3] baseband/acc: fix check after deref and dead code Date: Wed, 22 Feb 2023 08:40:41 -0800 Message-Id: <20230222164043.170909-2-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230222164043.170909-1-hernan.vargas@intel.com> References: <20230222164043.170909-1-hernan.vargas@intel.com> MIME-Version: 1.0 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") Cc: stable@dpdk.org Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc100_pmd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index 36f6fec5ad..baab459436 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -4106,8 +4106,6 @@ 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)) return 0; From patchwork Wed Feb 22 16:40:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hernan Vargas X-Patchwork-Id: 124402 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BB88D41D40; Wed, 22 Feb 2023 17:40:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0727E43154; Wed, 22 Feb 2023 17:40:40 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 3B543430CE for ; Wed, 22 Feb 2023 17:40:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677084035; x=1708620035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Pl7CvGWfhE8xb6qox+5nzxizY4EROd4n1fblO1pv+qI=; b=U13be2cyKLLmrKEftphIVLEeS9ZAHt6yzXMtxawkSbeA+H5tKYAOPzSu a4ZwbCJUTkQQmJGzzESIE30Zp9lASuSPG0eVq5FICVwss2aK8HCNHxAy4 WN6ypQAwkDyCGPUuIXHOd7+Vrnm4DV3K6ra5equLX6ynSn14lgYOXFY3y EK05/GDS5BV3OjtF9lV04s/kIenDF4sflAcaF+WwrxyXCdOVji4+hZ16v Txp4rwDub0Wkq5/ANuNa1zSVaVuKFilppp8TBAoKkHAy4OVggWE8r/abn ZfPQ1Q45ol+roC88+7Q+nr4w2U/sy/gtCNjiGYC1SWhbzLQS7Mp0fBpRz A==; X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="332973501" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="332973501" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2023 08:40:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="781504542" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="781504542" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by fmsmga002.fm.intel.com with ESMTP; 22 Feb 2023 08:40:33 -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 v3 2/3] baseband/acc: remove unused ops check Date: Wed, 22 Feb 2023 08:40:42 -0800 Message-Id: <20230222164043.170909-3-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230222164043.170909-1-hernan.vargas@intel.com> References: <20230222164043.170909-1-hernan.vargas@intel.com> MIME-Version: 1.0 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 Remove unnecessary debug check for ops. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc100_pmd.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index baab459436..c242f7737a 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -4106,10 +4106,6 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, int ret, cbm; struct rte_bbdev_enc_op *op; -#ifdef RTE_LIBRTE_BBDEV_DEBUG - if (unlikely(ops == 0)) - return 0; -#endif op = acc_op_tail(q, 0); if (unlikely(ops == NULL || op == NULL)) return 0; From patchwork Wed Feb 22 16:40:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hernan Vargas X-Patchwork-Id: 124403 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4A9141D40; Wed, 22 Feb 2023 17:40:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BB8C4315C; Wed, 22 Feb 2023 17:40:41 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 85F5E430EB for ; Wed, 22 Feb 2023 17:40:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677084035; x=1708620035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ij8mfCWryokYbvp/NS7X66nV0cZwGEvmZy7B3YkpH40=; b=D8oW5udXNhe5nTIzIsL2nlNq8w+bzKgQp2CQG7eb2U5MVUG0hiZskX4H pCFfhW7vfuvoabeA56186cvoq/wvhJtC5TypYXhFQUEwUf68UplVsbg1C H+W4x+XkKPP37wjYiWyum9LG0AkQBrf0z6ySNiOJzbIf2jitR4JhhF/Fg ToGEJAW2rBJnGTq/MbZP/czsv923f+RgWvqMRPQp91bJgi5IWZ1fj7+Nj kC1S4swMgvZ+ZSrNrBZV8avvY4pu87tzmeY5v1lNk/0PdsXdb9JE/3g/q 69bbCtogiMkrS23G9Je7laaZ5x/R/PwBzkcBXYH6bHv+1az4E+VzX37gQ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="332973509" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="332973509" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2023 08:40:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10629"; a="781504547" X-IronPort-AV: E=Sophos;i="5.97,319,1669104000"; d="scan'208";a="781504547" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by fmsmga002.fm.intel.com with ESMTP; 22 Feb 2023 08:40:33 -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 v3 3/3] baseband/acc: add check for empty queue Date: Wed, 22 Feb 2023 08:40:43 -0800 Message-Id: <20230222164043.170909-4-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230222164043.170909-1-hernan.vargas@intel.com> References: <20230222164043.170909-1-hernan.vargas@intel.com> MIME-Version: 1.0 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 Add optimization to return early if there are no available descriptors in ring to dequeue. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc100_pmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index c242f7737a..9941754aa0 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -4106,6 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, int ret, cbm; struct rte_bbdev_enc_op *op; + if (avail == 0) + return 0; + op = acc_op_tail(q, 0); if (unlikely(ops == NULL || op == NULL)) return 0;