From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id A616C45D16;
	Fri, 15 Nov 2024 21:08:09 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2CC9943281;
	Fri, 15 Nov 2024 21:08:05 +0100 (CET)
Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com
 [209.85.215.174])
 by mails.dpdk.org (Postfix) with ESMTP id D6B0240615
 for <dev@dpdk.org>; Fri, 15 Nov 2024 21:08:02 +0100 (CET)
Received: by mail-pg1-f174.google.com with SMTP id
 41be03b00d2f7-7ee020ec76dso1656609a12.3
 for <dev@dpdk.org>; Fri, 15 Nov 2024 12:08:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731701282;
 x=1732306082; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=fnZZbrHhooPBtodMvzo7g8k980Y++f3GyuEx+WfkGkI=;
 b=UKgVw9MPIC/kchFa4fODdlXaYIEfFayaZeERAaaPSTUdcSCd5n9f75yFEx8oLTUeY9
 LlvVy8wuMa9ICZImwQ9ulOuaYulWb5zQdIkSKMlpAlSNAJPTk5XJ2/cxSWJBMwYVik1I
 /nikE0Q5PE7603IC5IrEpOi4fM1k78d4b7IAKovI/ICokZ/CFehToAtfZkSOUDcFKX26
 0QIGp1mAK0miAlXP8kBntYZnlKJwUaEQHf1qBXdYpyl7sBKe9YHkKoJNfcm00IO7OKzx
 LtIrAjr14Dm8TcY2vjhOW68d8ievaCUuf759Lkj3Y8dQJgrMHFALw7NYEuncTKaCocfC
 GdiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1731701282; x=1732306082;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=fnZZbrHhooPBtodMvzo7g8k980Y++f3GyuEx+WfkGkI=;
 b=myjsTc68U9iNjasqtZ8x/oLXa25M9PpUbXKermhpRx9L7O3yN2QxPKA+u9Y20v+niz
 QrySwtyWt/xFfChRNHsQb1OkWzUGs8Rv61sGHV/8lSXdORFhWOjRYOlLT168hTKUCuMc
 fEDpEcaOB+eDtAWWHj8KUuaouULwYurTS2SYOiOtvOKIRLzlLQB7Fxc4Ef3/892yYS51
 Vx+6n2G/QIs0nZU3BpecQoiThM5dDN1CGba+yTBa4mEFvwHDolm6/G6uQqn2o3hxI1NE
 5QcmoVNmsKH7puXSXi/i5nd7tlxlp5to8Y8mNB05G69GmJqYXTGdxFmBTF4HCh6TrvVM
 2YwQ==
X-Gm-Message-State: AOJu0YyBULJqZV/Gnl/ygJ4ow8vofSDSqKba+K+ynjuydYVGf3w8jJuw
 YmsTCj60VWHEdNDutDm2+WeFYH/mrXtqsgHeg0GczMucByLfQJHTjp560Jwwn2Q2S0u/FdHfSVl
 G
X-Google-Smtp-Source: AGHT+IG4Bk6otuvyT988wevnwx1umXv4GdOxtmbVx8vwLmOh4AanqRAXQYevcKJHLLsUmEIL7ilQ8g==
X-Received: by 2002:a05:6a21:328f:b0:1db:ef5d:48ef with SMTP id
 adf61e73a8af0-1dc90b1cb86mr4846684637.14.1731701282059; 
 Fri, 15 Nov 2024 12:08:02 -0800 (PST)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-724771e11f0sm1759686b3a.131.2024.11.15.12.08.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 15 Nov 2024 12:08:01 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, declan.doherty@intel.com,
 stable@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
 Chas Williams <chas3@att.com>, "Min Hu (Connor)" <humin29@huawei.com>,
 Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [PATCH v3 01/10] app/test: do not duplicate loop variable
Date: Fri, 15 Nov 2024 12:06:45 -0800
Message-ID: <20241115200751.17141-2-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241115200751.17141-1-stephen@networkplumber.org>
References: <20241114001403.147609-1-stephen@networkplumber.org>
 <20241115200751.17141-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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@intel.com
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 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