DPDK patches and discussions
 help / color / mirror / Atom feed
From: Steve Yang <stevex.yang@intel.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, beilei.xing@intel.com,
	wenzhuo.lu@intel.com, bernard.iremonger@intel.com,
	qiming.yang@intel.com, mdr@ashroe.eu, nhorman@tuxdriver.com,
	andrew.rybchenko@oktetlabs.ru, Steve Yang <stevex.yang@intel.com>
Subject: [dpdk-dev] [PATCH v1] app/testpmd: fix the overhead overflow issue
Date: Thu,  5 Nov 2020 09:51:51 +0000
Message-ID: <20201105095151.61052-1-stevex.yang@intel.com> (raw)

If "dev_info.max_mtu" isn't set by driver, the rte_ethdev will set
default value "UINT16_MAX", that will cause the overhead value overflow.

Add more strict condition to ensure the overhead valid.

Fixes: bed05536c8f8 ("app/testpmd: fix max Rx packet length for VLAN packets")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c263121a9a..b34eaf2016 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1459,7 +1459,10 @@ init_config(void)
 				 "rte_eth_dev_info_get() failed\n");
 
 		/* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
-		if (port->dev_info.max_rx_pktlen && port->dev_info.max_mtu)
+		if (port->dev_info.max_mtu &&
+		    port->dev_info.max_mtu != UINT16_MAX &&
+		    port->dev_info.max_rx_pktlen &&
+		    port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
 			overhead_len = port->dev_info.max_rx_pktlen -
 				port->dev_info.max_mtu;
 		else
-- 
2.17.1


             reply	other threads:[~2020-11-05  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  9:51 Steve Yang [this message]
2020-11-05 14:31 ` Ferruh Yigit
2020-11-05 18:22   ` Thomas Monjalon

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20201105095151.61052-1-stevex.yang@intel.com \
    --to=stevex.yang@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=beilei.xing@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=mdr@ashroe.eu \
    --cc=nhorman@tuxdriver.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git