[PATCH v2 01/10] app/test: do not duplicated loop variable

Stephen Hemminger stephen at networkplumber.org
Thu Nov 14 20:24:59 CET 2024


Do not use same variable for outer and inner loop in bonding test.
Since the loop is just freeing the resulting burst use bulk free.

Link: https://pvs-studio.com/en/blog/posts/cpp/1179/

Fixes: 92073ef961ee ("bond: unit tests")
Cc: declan.doherty at intel.com
Cc: stable at dpdk.org

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/test/test_link_bonding.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c
index 4d54706c21..805613d7dd 100644
--- a/app/test/test_link_bonding.c
+++ b/app/test/test_link_bonding.c
@@ -2288,12 +2288,7 @@ test_activebackup_rx_burst(void)
 		}
 
 		/* free mbufs */
-		for (i = 0; i < MAX_PKT_BURST; i++) {
-			if (rx_pkt_burst[i] != NULL) {
-				rte_pktmbuf_free(rx_pkt_burst[i]);
-				rx_pkt_burst[i] = NULL;
-			}
-		}
+		rte_pktmbuf_free_bulk(rx_pkt_burst, burst_size);
 
 		/* reset bonding device stats */
 		rte_eth_stats_reset(test_params->bonding_port_id);
-- 
2.45.2



More information about the stable mailing list