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 DEC9D41C50 for ; Fri, 10 Feb 2023 19:02:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55B5042D4A; Fri, 10 Feb 2023 19:02:54 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5E2DB42C54; Fri, 10 Feb 2023 19:02:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676052166; x=1707588166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7AyhrUkWETyZi3oir1zCEeWil7sh6O1JaTNtJ1lNXkg=; b=X7W7rfytU83Yd5/Eh2NzdK9c5/KPagFyjI9JtfzKPyu8YJ8PhOIdtQxD 04X8u254al+Erd55YCTMW/1GCqrmHqz0C6OQSCIvgnOoER12wSyGIPg5Q amrWKuZtg212FLFv69/ctNxl7I5Bw3l758b+M+atwr7K6ddbfF0Sm/E+k yYwDM57tM+UHN+Ntugp0J5fSgbkxfXDkifrPQjLz1kAOGaiKm8/0J0OAh nNri3w/Go1MMIGbkGoQHZ/0KBy3QrmomE/sgOFT3u0AEEkFZviql1B+mx hTD7dx+13dcOr3cVdrZtl2Aw/6iTDPTRlqIKo3iQX8oSmrJtlEzEYuL/8 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10617"; a="310117915" X-IronPort-AV: E=Sophos;i="5.97,287,1669104000"; d="scan'208";a="310117915" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2023 10:02:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10617"; a="670076719" X-IronPort-AV: E=Sophos;i="5.97,287,1669104000"; d="scan'208";a="670076719" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by fmsmga007.fm.intel.com with ESMTP; 10 Feb 2023 10:02:15 -0800 From: Nicolas Chautru To: dev@dpdk.org, maxime.coquelin@redhat.com Cc: hernan.vargas@intel.com, stable@dpdk.org, Nicolas Chautru Subject: [PATCH v2 6/9] baseband/acc: fix potential arithmetic overflow Date: Fri, 10 Feb 2023 17:58:38 +0000 Message-Id: <20230210175841.303450-7-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230210175841.303450-1-nicolas.chautru@intel.com> References: <20230209221929.265059-2-nicolas.chautru@intel.com> <20230210175841.303450-1-nicolas.chautru@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Fix potential issue of overflow causing coverity warning. 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 ccd3adaf93..82dbfcaa53 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 -- 2.34.1