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 807F1A0093; Wed, 27 Apr 2022 20:23:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E5A242815; Wed, 27 Apr 2022 20:22:39 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id E9F6742800 for ; Wed, 27 Apr 2022 20:22:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651083755; x=1682619755; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Kq6UBgHs/W8rU78GyfDS348WWfhw4BEUNqJ5Dsj+fB8=; b=EOGWdO8roih6fputwl8KdRYkpWB0KRoCPTQ4xGRdAqaPCLlzBET+pRMI tsiIpOJxfnhVZUIEpF6qey6YuZhW6gyvEsmjqfA9KcfJPjnyg7/4nBaKo YtLoP/AunUEXzsd4myuSINqrK/rG6nF2eZuYszuEHIdjpRUvy5d2QqWNX kQewqy3Qcg5bPA3ZJGHiAGfZFf4gu7cbOcJ1LbTU/mndNkOs9ER//z3gG SVy3uv5AQ4yrh/iOyQO+uM3z5ze6aH+I3V3Kog4CdN4QaUipm3M4Arkzf zaLQ1DdbNQ61+O5nE7F3Fyu5obMcIk8vasd+27DL8KT7PdkXk4F8GWt3P A==; X-IronPort-AV: E=McAfee;i="6400,9594,10330"; a="246587339" X-IronPort-AV: E=Sophos;i="5.90,293,1643702400"; d="scan'208";a="246587339" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2022 11:22:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,293,1643702400"; d="scan'208";a="730937313" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by orsmga005.jf.intel.com with ESMTP; 27 Apr 2022 11:22:29 -0700 From: Nicolas Chautru To: dev@dpdk.org, gakhil@marvell.com Cc: trix@redhat.com, thomas@monjalon.net, ray.kinsella@intel.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, mingshan.zhang@intel.com, david.marchand@redhat.com, Nicolas Chautru Subject: [PATCH v2 5/5] baseband/acc100: add protection for some negative scenario Date: Wed, 27 Apr 2022 11:17:03 -0700 Message-Id: <1651083423-33202-6-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1651083423-33202-1-git-send-email-nicolas.chautru@intel.com> References: <1651083423-33202-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. 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; 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; -- 1.8.3.1