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 A467B42B83; Tue, 23 May 2023 20:49:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96CEF40A80; Tue, 23 May 2023 20:49:31 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0324440689; Tue, 23 May 2023 20:49:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684867769; x=1716403769; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6nJfErOKkpeVR6HkZI+pPmSopMXl0Tbfbw4eNSrNTpc=; b=Za1fQm1rbUtNgcGCeB+t6eU/ueV8ahjgKN/UcKpkqk6nCNLaN8zDAqox DogfCHA3kPe+PVqmf5xjPOoik6GIaXxlGYcvgzZ+m+tosPLIe2HJ88Kt2 taB/2yRfkrWa7GPuFXZZK+uHnWAesnYmpfVib0Dv+KIyocTZymKqNtm4X V1m6FRipTnUiQw5oITyISveAJxZ9+MLglOfq4KrbV4JyVqOcPE3ZKojZm bTyBu/4vAeNf0/pHsBnM/RQzHcIi/QPrMLcrmK9XZdMTYv1NsCpcEfV3l nPms1X21OtBdqzKjQHnu8W/rqyw9BBt4mEODg3BODTGrPgwOsgn0koU0o w==; X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="439677938" X-IronPort-AV: E=Sophos;i="6.00,187,1681196400"; d="scan'208";a="439677938" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 11:49:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="878317343" X-IronPort-AV: E=Sophos;i="6.00,187,1681196400"; d="scan'208";a="878317343" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by orsmga005.jf.intel.com with ESMTP; 23 May 2023 11:49:26 -0700 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, Hernan Vargas , stable@dpdk.org Subject: [PATCH v1 1/6] baseband/fpga_5gnr_fec: fix possible div by zero Date: Tue, 23 May 2023 11:48:13 -0700 Message-Id: <20230523184818.139353-2-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230523184818.139353-1-hernan.vargas@intel.com> References: <20230523184818.139353-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 Add fix to have an early exit when z_c is zero to prevent a possible division by zero. Fixes: 44dc6faa796f ("baseband/fpga_5gnr_fec: add LDPC processing functions") Cc: stable@dpdk.org Signed-off-by: Hernan Vargas --- drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c index f29565af8cca..9388cce52960 100644 --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c @@ -879,6 +879,8 @@ get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index) { if (rv_index == 0) return 0; + if (z_c == 0) + return 0; uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c; if (n_cb == n) { if (rv_index == 1) -- 2.37.1