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 2C0F7A054F; Wed, 1 Jun 2022 00:41:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C9C942905; Wed, 1 Jun 2022 00:41:34 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 5512A40A89; Wed, 1 Jun 2022 00:41:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654036891; x=1685572891; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=CFYLeFd2NXz3f5i3Wg7bRIPm149OCOqt0/5vgmbRxzs=; b=DraFVnlkNl5hvBEiCMCjsU5omdUqji1jjpLAo25Zh7p2Lt8cAx1j/08k eMfbYWU5qlg+ydXawO+2baiE/nuqYKYP7gIAw2iyfeYXqtLeaZQOuDNVW aVt/5P/gZCUldTuD3ej6566oNpsDMdaYm4StwBbyu/KS/2SeNVU5A7TcF EWLbtAvWhGsqFpzT3y3+v3FWrEzhFdp4JQeNzDbs/5GWhN3/L5Xd9Faxr iLJRYpZmSUZDzWqAN1BM7ndmD09PY+WNHqfqIAJvdxGjZ3hT9pS6W4iLB mIkZmelghr45sZZ/nePQD+7Nlg9nHZmlZ8BuLxPnOW7cXIZpjnUmd+b+t w==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="336063065" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="336063065" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 15:41:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="581299837" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by fmsmga007.fm.intel.com with ESMTP; 31 May 2022 15:41:28 -0700 From: Nicolas Chautru To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com, maxime.coquelin@redhat.com Cc: thomas@monjalon.net, ray.kinsella@intel.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, hernan.vargas@intel.com, david.marchand@redhat.com, Nicolas Chautru , stable@dpdk.org Subject: [PATCH v7 2/6] baseband/acc100: add protection for some negative scenario Date: Tue, 31 May 2022 15:31:43 -0700 Message-Id: <1654036307-182860-3-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1654036307-182860-1-git-send-email-nicolas.chautru@intel.com> References: <1653350912-53876-1-git-send-email-nicolas.chautru@intel.com> <1654036307-182860-1-git-send-email-nicolas.chautru@intel.com> 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 Catch exception in PMD in case of invalid input parameter. Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions") Cc: stable@dpdk.org Signed-off-by: Nicolas Chautru --- drivers/baseband/acc100/rte_acc100_pmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index 79bee43..32c8bc2 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -1236,6 +1236,8 @@ return (bg == 1 ? ACC100_K0_3_1 : ACC100_K0_3_2) * z_c; } /* LBRM case - includes a division by N */ + if (unlikely(z_c == 0)) + return 0; if (rv_index == 1) return (((bg == 1 ? ACC100_K0_1_1 : ACC100_K0_1_2) * n_cb) / n) * z_c; @@ -1764,6 +1766,10 @@ /* Soft output */ if (check_bit(op->turbo_dec.op_flags, RTE_BBDEV_TURBO_SOFT_OUTPUT)) { + if (op->turbo_dec.soft_output.data == 0) { + rte_bbdev_log(ERR, "Soft output is not defined"); + return -1; + } if (check_bit(op->turbo_dec.op_flags, RTE_BBDEV_TURBO_EQUALIZER)) *s_out_length = e; -- 1.8.3.1