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 2BBD6A0501; Sun, 8 May 2022 15:55:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C906B4068F; Sun, 8 May 2022 15:55:39 +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 C720740395 for ; Sun, 8 May 2022 15:55:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652018138; 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=ZuHfV5k8USgXjc1vW7Mi1AZx0x8LdwOqN5OmRcegQo4=; b=TH4vlU4yiyrtRoJ5J1IcMI4mNFpSECaWvsqYlcONzO3j0tA/YcxHA9a0p0QuIi63ULF7wT oveBcR4cMtU1UJnFCRXO1t/EygsBZ6oiWYbSq6YU1/jELi+rhhOAiHL7crGrHE4fYDO/F6 aRRbrVv6SYi+vc+KvyTWVUcRgUySdPI= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-OD2ZnLhbOQ6wPjYBXczXnA-1; Sun, 08 May 2022 09:55:35 -0400 X-MC-Unique: OD2ZnLhbOQ6wPjYBXczXnA-1 Received: by mail-qv1-f69.google.com with SMTP id n5-20020a0cbe85000000b0045aff56564bso2149810qvi.4 for ; Sun, 08 May 2022 06:55:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ZuHfV5k8USgXjc1vW7Mi1AZx0x8LdwOqN5OmRcegQo4=; b=rT0/Iy8j+7xcX4xPOhiT7AA22Zp8p4+KhQg+oO/x9cWLQ2CUM3Mk1k4Kw0By0V+J+M IwkSVrIawSq7eeAq8rogDQqlGIVySZsjHQsvjuo8gxw1+wm+aAwTsZMi5o5BFIZLpg89 4Tqua+A8qGpdVES1g6BtOSOA9FmrlAj5PHorAXst0OCQ+k91lN+Zw2DRamA/mRj1VX4p 66MltRK1M4OXU8YF5wzGPGM+7FTq6hChwxqLgzdw8bCxOO1CO0XWw6c3fkv1a+NuzjRM hXfmZDmuWkwXGwelCpag3Iy8rfBBOMcyGxLEcYals+98INfdVpvGktOOwifbNRWgoOru qxiA== X-Gm-Message-State: AOAM531VdGZLo3/Ndic2x3Sk471ivCFc27eTV2cfIp1uFnP0O6oOsFie TqmS95VfaOoHzJynWv232rqZ/iOvXDEnycW5nnoRW0nSSouvMsWPhscL+ZreWVAMG9V7XsjO44h Owuw= X-Received: by 2002:ac8:7d83:0:b0:2e1:eca2:afb0 with SMTP id c3-20020ac87d83000000b002e1eca2afb0mr11203373qtd.521.1652018134886; Sun, 08 May 2022 06:55:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD301qC8TlyBUPO1RuusNm2iv/4Tf8yQmP54Th2uNXlZ2pD1IUvJ97z0853sHoWiLifTU8oA== X-Received: by 2002:ac8:7d83:0:b0:2e1:eca2:afb0 with SMTP id c3-20020ac87d83000000b002e1eca2afb0mr11203355qtd.521.1652018134690; Sun, 08 May 2022 06:55:34 -0700 (PDT) Received: from localhost.localdomain (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id y7-20020ac87c87000000b002f39b99f67csm6001573qtv.22.2022.05.08.06.55.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 May 2022 06:55:33 -0700 (PDT) Subject: Re: [PATCH v2 5/5] baseband/acc100: add protection for some negative scenario To: Nicolas Chautru , dev@dpdk.org, gakhil@marvell.com Cc: thomas@monjalon.net, ray.kinsella@intel.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, mingshan.zhang@intel.com, david.marchand@redhat.com References: <1651083423-33202-1-git-send-email-nicolas.chautru@intel.com> <1651083423-33202-6-git-send-email-nicolas.chautru@intel.com> From: Tom Rix Message-ID: <1c8eb52f-437e-c5eb-ed85-182dc8b81499@redhat.com> Date: Sun, 8 May 2022 06:55:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <1651083423-33202-6-git-send-email-nicolas.chautru@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US 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 4/27/22 11:17 AM, Nicolas Chautru wrote: > Catch exception in PMD in case of invalid input parameter. It is not clear if this is 1 fix or 2. But it does look like an acc100 fix so it should be split from the acc101 patchset. > > 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 b588f5f..a13966c 100644 > --- a/drivers/baseband/acc100/rte_acc100_pmd.c > +++ b/drivers/baseband/acc100/rte_acc100_pmd.c > @@ -1241,6 +1241,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; This check should be moved to earlier, if 'n' is set to 0 in the statement above, there is div by 0 later Tom > if (rv_index == 1) > return (((bg == 1 ? ACC100_K0_1_1 : ACC100_K0_1_2) * n_cb) > / n) * z_c; > @@ -1916,6 +1918,10 @@ static inline uint32_t hq_index(uint32_t offset) > > /* 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;