From patchwork Thu Feb 9 22:19:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 123616 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F273341C56; Thu, 9 Feb 2023 23:23:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CCC442D49; Thu, 9 Feb 2023 23:23:18 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 6CD1F42670; Thu, 9 Feb 2023 23:23:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675981389; x=1707517389; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gVGfCBfJeEdv1CeYx1HsVRQU19v0Vkh5Qyml2wKWqmM=; b=IkWkuTnqWyYy41KtxSJo2cyIxEAYejD6h4kWdWJjW2XeTug4gWwqCCnT fYKURChqV/T+jJuSM5sXAK3wJh0M+f6yc7LFk8jUqIeOOL5xqHerXO2xV Qc730L2xQ7zRZlwLREfIFba85XuroKvc5Z3HcFAiORpDX7Z5ebT+sQUW8 HnvY2zQyLaG3/v1+35Au6YCRHUZJCTPgRFJaQaNe9uKgtEJJ1rdxFNehA jFIWpjj9B9SBe/GOAfzq1hYGA8XuLDKq9BzpDkyJkr5GN8j5Q0459Px4/ lD+nc3IAkr1juGKI4L8FBi3yFG7BPdChGmTlO3mcb9XmWPymTImzIzZ3r g==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="331563046" X-IronPort-AV: E=Sophos;i="5.97,285,1669104000"; d="scan'208";a="331563046" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2023 14:23:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="736513280" X-IronPort-AV: E=Sophos;i="5.97,285,1669104000"; d="scan'208";a="736513280" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by fmsmga004.fm.intel.com with ESMTP; 09 Feb 2023 14:23:06 -0800 From: Nicolas Chautru To: dev@dpdk.org, maxime.coquelin@redhat.com Cc: hernan.vargas@intel.com, stable@dpdk.or, Nicolas Chautru , stable@dpdk.org Subject: [PATCH v1 7/9] baseband/acc: fix potential arithmetic overflow Fix potential issue of overflow causing coverity warning. Date: Thu, 9 Feb 2023 22:19:27 +0000 Message-Id: <20230209221929.265059-8-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209221929.265059-1-nicolas.chautru@intel.com> References: <20230209221929.265059-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 Coverity issue: 383154 Fixes: 8e16839937 ("baseband/acc: extension of the device structure") Cc: stable@dpdk.org Signed-off-by: Nicolas Chautru Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_vrb_pmd.c | 2 +- drivers/baseband/acc/vrb_pmd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c index 0bd5c65177..8fcb06b4ff 100644 --- a/drivers/baseband/acc/rte_vrb_pmd.c +++ b/drivers/baseband/acc/rte_vrb_pmd.c @@ -518,7 +518,7 @@ vrb_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id) if (d->tail_ptrs == NULL) d->tail_ptrs = rte_zmalloc_socket( dev->device->driver->name, - d->num_qgroups * d->num_aqs * sizeof(uint32_t), + VRB_MAX_QGRPS * VRB_MAX_AQS * sizeof(uint32_t), RTE_CACHE_LINE_SIZE, socket_id); if (d->tail_ptrs == NULL) { rte_bbdev_log(ERR, "Failed to allocate tail ptr for %s:%u", diff --git a/drivers/baseband/acc/vrb_pmd.h b/drivers/baseband/acc/vrb_pmd.h index f3c9239881..01028273e7 100644 --- a/drivers/baseband/acc/vrb_pmd.h +++ b/drivers/baseband/acc/vrb_pmd.h @@ -36,6 +36,7 @@ #define VRB_NUM_ACCS 6 #define VRB_MAX_QGRPS 32 +#define VRB_MAX_AQS 32 #define ACC_STATUS_WAIT 10 #define ACC_STATUS_TO 100