Skip to content

Commit 163fbaa

Browse files
Ferruh Yigittmonjalo
Ferruh Yigit
authored andcommitted
app/testpmd: fix crash
Testpmd tries to calculate mbuf size based on "max Rx packet size" and "max MTU segment number". When driver set a "nb_mtu_seg_max" to zero, it causes division by zero segmentation fault in testpmd. If the PMD set "nb_mtu_seg_max" to zero, testpmd shouldn't try to calculate the mbuf size. Fixes: 33f9630 ("app/testpmd: create mbuf based on max supported segments") Signed-off-by: Ferruh Yigit <[email protected]>
1 parent c530aa7 commit 163fbaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/test-pmd/testpmd.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ init_config(void)
11741174
/* Check for maximum number of segments per MTU. Accordingly
11751175
* update the mbuf data size.
11761176
*/
1177-
if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX) {
1177+
if (port->dev_info.rx_desc_lim.nb_mtu_seg_max != UINT16_MAX &&
1178+
port->dev_info.rx_desc_lim.nb_mtu_seg_max != 0) {
11781179
data_size = rx_mode.max_rx_pkt_len /
11791180
port->dev_info.rx_desc_lim.nb_mtu_seg_max;
11801181

0 commit comments

Comments
 (0)