From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 901ABC433EF for ; Thu, 2 Jun 2022 08:21:26 +0000 (UTC) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F38040696; Thu, 2 Jun 2022 10:21:25 +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 6BDA54021E for ; Thu, 2 Jun 2022 10:21:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654158082; 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=McTMHJAjxIl0l4I4QY92pJuaI1AeXfmakKG7rG0AhMo=; b=RGKE9eY+UZ3Uvdokz26y8X1TUqsEgY82tudvqZCxA3XxlRhYQ2Ve01FeVQnYk+0scfiJ9A GIbB6Kx5V66smVWUp1UgdK2dDqqa0jbUXqWejTx8Vxh8/NpfvtseCR6sgGjeF3Jc3dZm6w eF0wKaHuKmG9WmO9/8rlRwbjtIM3HCM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-368-wLBp5GkwNbKr6RdC48aAUQ-1; Thu, 02 Jun 2022 04:21:17 -0400 X-MC-Unique: wLBp5GkwNbKr6RdC48aAUQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B7123816856; Thu, 2 Jun 2022 08:21:17 +0000 (UTC) Received: from [10.39.208.18] (unknown [10.39.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B586C27E8F; Thu, 2 Jun 2022 08:21:15 +0000 (UTC) Message-ID: <2a7ef4f9-5499-d6fa-190a-3559d9e3c9f1@redhat.com> Date: Thu, 2 Jun 2022 10:21:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v7 2/6] baseband/acc100: add protection for some negative scenario To: Nicolas Chautru , dev@dpdk.org, gakhil@marvell.com, trix@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, stable@dpdk.org References: <1653350912-53876-1-git-send-email-nicolas.chautru@intel.com> <1654036307-182860-1-git-send-email-nicolas.chautru@intel.com> <1654036307-182860-3-git-send-email-nicolas.chautru@intel.com> From: Maxime Coquelin In-Reply-To: <1654036307-182860-3-git-send-email-nicolas.chautru@intel.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com 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: 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 On 6/1/22 00:31, Nicolas Chautru wrote: > 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; Reviewed-by: Maxime Coquelin Thanks, Maxime