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 655B745D16;
	Fri, 15 Nov 2024 21:09:07 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 50DC6432F2;
	Fri, 15 Nov 2024 21:08:19 +0100 (CET)
Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com
 [209.85.210.172])
 by mails.dpdk.org (Postfix) with ESMTP id 011AC432B2
 for <dev@dpdk.org>; Fri, 15 Nov 2024 21:08:10 +0100 (CET)
Received: by mail-pf1-f172.google.com with SMTP id
 d2e1a72fcca58-720d5ada03cso1077917b3a.1
 for <dev@dpdk.org>; Fri, 15 Nov 2024 12:08:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1731701290;
 x=1732306090; 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=cIWulhwSAyge9bSQImZ8PLcwOkuxAeFnnCOSu2o4Uy0=;
 b=UvVFU4Osecj2Hs96EGjYM9KwVU3uKI4qqlGQuwVuGms+UwTX9k6d47dwdFF2gGOiT9
 SNFLyzAwmtpMSDRoSGpEhUh4MCQAcy+ZrM47eVtSWtkQiyWd+sjJfy6G8Onko8TElKPZ
 tz7s6RV/JAvU8ARpyDcRAmCUcQ2t2j64wx4gyCaVFWpCYG60obfnH1KCSkVBG+UoEO7b
 e7G2xe4zC6/IEzOZ72WKSJ7bwy48w4vc5bmz4G09aiUiU5spdZjkwq8WB4G0eqZUvgT5
 +OBCoUQNKUfHit5sRVUNCOy/L8soEywLKHoBqwd7McNSbuE1qs3TirGoZ+w/1P3nxb0g
 mRQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1731701290; x=1732306090;
 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=cIWulhwSAyge9bSQImZ8PLcwOkuxAeFnnCOSu2o4Uy0=;
 b=rk//JG8hN8S1TkeRmatcblL0vfzESOXvfRUIgGz2MumBRBuicgIhx6Vw8m0NLg0Zw/
 vqgHs/tPSOmNWqpVJdhARVSEKlcj+cwZhg33r5BVLcfzqPbF/6JJ+ZwnqeicJ84dbd00
 pw2XL7UXxLwo0tH395/leMlIRzp1vxUuKaBJQuVKheGKSS2oZzi1hoNh7ukaXxQESUjq
 oMzhBt/ufleiZHZSY407eqfFEMhn033oQGF70vbF3xJ1MXmVmhhr2UPF6SoyoliypDRz
 C8H7OtD7kLbUzDFTeiw5B5F782Nr0n6cPlky0ItmB6oKG+Id95ZX8H8xk6ZnzrLNcgaH
 sjbQ==
X-Gm-Message-State: AOJu0YwSAJk/Q6xlLA//6rXWu0tNKtYvnMHiwMM1qGShGBFPTQ7rFwxc
 WMYqN5MBdYupLACQyxDo/Q3NyfNVJlEo6OZRJn0dV37xb9Zg8UB0YbW0uAomxeRXqsUovajxazu
 V
X-Google-Smtp-Source: AGHT+IF3EayPFgZiZBRF6lf4mfgFi4g79tdea2ki2mHKfruFHO8/r/ZxdlisyMwvkmA524KOeBv8VA==
X-Received: by 2002:a05:6a00:98d:b0:71e:4414:eb21 with SMTP id
 d2e1a72fcca58-72476cc96f4mr4538259b3a.17.1731701290224; 
 Fri, 15 Nov 2024 12:08:10 -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.09
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 15 Nov 2024 12:08:09 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, cheng1.jiang@intel.com,
 stable@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,
 Cheng Jiang <honest.jiang@foxmail.com>,
 Chengwen Feng <fengchengwen@huawei.com>, Yuan Wang <yuanx.wang@intel.com>,
 Chenbo Xia <chenbox@nvidia.com>, Anoob Joseph <anoobj@marvell.com>,
 Jiayu Hu <hujiayu.hu@foxmail.com>
Subject: [PATCH v3 10/10] app/test-dma-perf: fix parsing of DMA address
Date: Fri, 15 Nov 2024 12:06:54 -0800
Message-ID: <20241115200751.17141-11-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

There was useless loop when looking at the DMA address.
It looks like it was meant to skip whitespace before
calling strtok.

Good time to replace strtok with strtok_r as well.

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

Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: cheng1.jiang@intel.com
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-dma-perf/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index 18219918cc..8d46b1258b 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -229,8 +229,8 @@ parse_lcore_dma(struct test_configure *test_case, const char *value)
 		return -1;
 	addrs = input;
 
-	while (*addrs == '\0')
-		addrs++;
+	while (isspace(*addrs))
+		++addrs;
 	if (*addrs == '\0') {
 		fprintf(stderr, "No input DMA addresses\n");
 		ret = -1;
-- 
2.45.2