From patchwork Thu Oct 29 11:25:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Weiser X-Patchwork-Id: 82738 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE03AA04B5; Thu, 29 Oct 2020 12:26:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4C900CA32; Thu, 29 Oct 2020 12:26:49 +0100 (CET) Received: from smtprelay05.ispgateway.de (smtprelay05.ispgateway.de [80.67.31.94]) by dpdk.org (Postfix) with ESMTP id DABBECA2E for ; Thu, 29 Oct 2020 12:26:46 +0100 (CET) Received: from [93.206.1.228] (helo=nb-martin.allegro) by smtprelay05.ispgateway.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) (envelope-from ) id 1kY61B-0005pH-Qf; Thu, 29 Oct 2020 12:22:57 +0100 From: Martin Weiser To: Ciara Loftus , Qi Zhang Cc: dev@dpdk.org, Martin Weiser Date: Thu, 29 Oct 2020 12:25:42 +0100 Message-Id: <20201029112542.96131-1-martin.weiser@allegro-packets.com> X-Mailer: git-send-email 2.29.1 MIME-Version: 1.0 X-Df-Sender: bWFydGluLndlaXNlckBhbGxlZ3JvLXBhY2tldHMuY29t Subject: [dpdk-dev] [PATCH] net/af_xdp: fix integer overflow in umem size calculation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The multiplication of two u32 integers may cause an overflow with large mempool sizes. Fixes: 74b46340e2d4 ("net/af_xdp: support shared UMEM") Cc: ciara.loftus@intel.com Signed-off-by: Martin Weiser Reviewed-by: Ferruh Yigit --- drivers/net/af_xdp/rte_eth_af_xdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index df2767b81..4076ff797 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -968,7 +968,8 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, umem->mb_pool = mb_pool; base_addr = (void *)get_base_addr(mb_pool, &align); - umem_size = mb_pool->populated_size * usr_config.frame_size + + umem_size = (uint64_t)mb_pool->populated_size * + (uint64_t)usr_config.frame_size + align; ret = xsk_umem__create(&umem->umem, base_addr, umem_size,