Skip to contentSkip to conversation

app/testpmd: fix the overhead overflow issue

PATCH In review Steve Yang 3 participants 3 messages Nov 5, 2020

lore
Share & tools
lore

Steve Yang

author
#0 lore raw

PATCH 1/1 app/testpmd: fix the overhead overflow issue

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")
---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
app/test-pmd/testpmd.c +4 -1
index c263121a9a..b34eaf2016 100644
@@ -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
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Steve Yang

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")
#2 lore raw

05/11/2020 15:31, Ferruh Yigit:

Quoted 11 lines · Steve Yang
Quoted 8 lines

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")

Rejected because causing other issues:
http://inbox.dpdk.org/dev/CADyeNEB2610Shzm6QN--wO8wDzg_-QtYuG05=gWrcaA39h0_ww@mail.gmail.com/