DPDK patches and discussions
 help / color / mirror / Atom feed
From: Martin Weiser <martin.weiser@allegro-packets.com>
To: Ciara Loftus <ciara.loftus@intel.com>, Qi Zhang <qi.z.zhang@intel.com>
Cc: dev@dpdk.org, Martin Weiser <martin.weiser@allegro-packets.com>
Subject: [dpdk-dev] [PATCH] net/af_xdp: fix integer overflow in umem size calculation
Date: Thu, 29 Oct 2020 12:25:42 +0100	[thread overview]
Message-ID: <20201029112542.96131-1-martin.weiser@allegro-packets.com> (raw)

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 <martin.weiser@allegro-packets.com>
 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 +
 		ret = xsk_umem__create(&umem->umem, base_addr, umem_size,

             reply	other threads:[~2020-10-29 11:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 11:25 Martin Weiser [this message]
2020-10-29 12:41 ` Martin Weiser
2020-10-30 15:01   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201029112542.96131-1-martin.weiser@allegro-packets.com \
    --to=martin.weiser@allegro-packets.com \
    --cc=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).