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 5991542DE6 for ; Thu, 6 Jul 2023 11:10:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51E1F42DC2; Thu, 6 Jul 2023 11:10:44 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5DFAC40F16 for ; Thu, 6 Jul 2023 11:10:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688634642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=snCoKwIlTD80axmbRwblEfSLMxslgCqk2T4PWe+FIBM=; b=PDJ7mIywFcYusnaFw1ohAFAF39B7CpPqF/3yS9exEUrMxvTeM3d0RiNpDT4RzB4HdIxUP9 iNbx2dk7ry8gwg8b+sM52H6NppFw1ro36QNyqXNTNiPPI6WF5wZxW5Wr1QbBMC/vrYnrK+ 2OOHQcmt9nHlVTeFhErR0stErXnQv6A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-116-P-ZSihnBPaGPiCjtb0Y_nQ-1; Thu, 06 Jul 2023 05:10:40 -0400 X-MC-Unique: P-ZSihnBPaGPiCjtb0Y_nQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8DA888022EF; Thu, 6 Jul 2023 09:10:39 +0000 (UTC) Received: from [10.39.208.34] (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 278792166B25; Thu, 6 Jul 2023 09:10:37 +0000 (UTC) Message-ID: Date: Thu, 6 Jul 2023 11:10:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2 1/6] baseband/fpga_5gnr_fec: fix possible div by zero To: Hernan Vargas , dev@dpdk.org, gakhil@marvell.com, trix@redhat.com Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com, stable@dpdk.org References: <20230525182812.152907-1-hernan.vargas@intel.com> <20230525182812.152907-2-hernan.vargas@intel.com> From: Maxime Coquelin In-Reply-To: <20230525182812.152907-2-hernan.vargas@intel.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 5/25/23 20:28, Hernan Vargas wrote: > 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 > Reviewed-by: Maxime Coquelin > --- > drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > 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..99390c48160c 100644 > --- a/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c > +++ b/drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c > @@ -877,9 +877,11 @@ check_desc_error(uint32_t error_code) { > static inline uint16_t > get_k0(uint16_t n_cb, uint16_t z_c, uint8_t bg, uint8_t rv_index) > { > + uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c; > if (rv_index == 0) > return 0; > - uint16_t n = (bg == 1 ? N_ZC_1 : N_ZC_2) * z_c; > + if (z_c == 0) > + return 0; > if (n_cb == n) { > if (rv_index == 1) > return (bg == 1 ? K0_1_1 : K0_1_2) * z_c; Applied to dpdk-next-baseband/for-main. Thanks, Maxime