From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1DE3045D0F; Fri, 15 Nov 2024 10:13:28 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E26742FBB; Fri, 15 Nov 2024 10:13:27 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by mails.dpdk.org (Postfix) with ESMTP id 0330440278; Fri, 15 Nov 2024 10:13:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731662005; x=1763198005; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=FC6Jt5gZHsEXUYIStf33XK15/+dpW14Q6FTT2GxKK5E=; b=jJ52gNNtt6xuynDQXlrGmqoVPdyeBNAWV4D3VqdqjzHGkhS+XYmIVnMk 59ezpeaRSayGp7bEuWDbJ6muQ4an5O7KsyRUSj9tCyv4u/VArVqiUcmeM t++0SmBU4TTnUOk6NTmBU4wsF5+7pz+axrnPpiSIXqh6uYESh0BMPQTOY 2px1H48bnIilBENC+l94+fMU3EjDxWBEcX3ZauBs/EfmUp5iT/Q3WPGoI kyVcMCjzLxMlOw9a3QWZ8X6Bfcmyxyj77c2RIFZtNGVVncd1JBN8vz66v ttkbEKDcMRJ8KtHPwuSU7bdH0bSIxrK+NJ2nFKPWVb/tUpFdIj9RyYGXF Q==; X-CSE-ConnectionGUID: dBlEc7daS1uraCKcU73u1A== X-CSE-MsgGUID: 2OQcRcmcQWOzgcFUtvIKlg== X-IronPort-AV: E=McAfee;i="6700,10204,11256"; a="31612865" X-IronPort-AV: E=Sophos;i="6.12,156,1728975600"; d="scan'208";a="31612865" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2024 01:13:23 -0800 X-CSE-ConnectionGUID: U86khfBbSNSFx6VXtuZlew== X-CSE-MsgGUID: gHiPSjO/RjWxjfNITbolOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,156,1728975600"; d="scan'208";a="93459772" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa005.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 15 Nov 2024 01:13:24 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 15 Nov 2024 01:13:23 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 15 Nov 2024 01:13:23 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.47) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 15 Nov 2024 01:13:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qZGmTn+Y3P62OoFVLNbh4uW016jCWSa/UcK5gIFhNof9Ou1KqhHAkFu+N8OQT33TSbCAFewj5m0l2ChE2tYZbdrvTrp4gY9fpIIU0jzulnNAaOZhutJSIb6t1xsrAHCUOyq5mWsdfTRHHs+o1Z1q5C53prkv8jVyoFV9PyLAiF9DniFSKchor8RBxTa8Or6Fl3zT8vjJnqaRSsDIVBXFm9rz3dGJeFgwlnj2mrV6GNfRdf+ALviJPkRUTriCqSy5B49qQ8ujtXUHGXd1pbcOpg7hl4DCBf83e8U8BtiqxjbIIGkhwU0Lp5J6ct/zIRz4hC4zTsvQCLdaY7UR2xZC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PufaGujH99qwS4in0x5mEnCYmqYHlKTWHp64d2acwlA=; b=glpCqLQZAiuf9qun8ptdNGL7Rax0xaf5S6x953pCxfr8+F7lkWdTtrPU8B7ZsjDEEdFxzYa9QZkggBz3c095qKSPgKvf4JdyYq0owTUYxSue8qJMzDwlrcC0kFmlxTIQOUJZkkdQ2dTfqPjV1lGgUosse8F+o7xHFDpcohNduxielEhtsrUwJV+2pUohXCjAoG2hQ7pfToHhIxPlRby9mTRePKQD551yYF0IsLsJEbza0JIMBXqWO8ZfK7O5xKQ8CFvvpVraaOtFxtD47jIpO///0RWTurax4GnnZ2J2wxCERSsqF9EhDnO+NTURXt2GXCuVxLRLdJRFXCTx4KfQ8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SA2PR11MB5180.namprd11.prod.outlook.com (2603:10b6:806:fb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.19; Fri, 15 Nov 2024 09:13:19 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::f120:cc1f:d78d:ae9b%4]) with mapi id 15.20.8093.018; Fri, 15 Nov 2024 09:13:19 +0000 Date: Fri, 15 Nov 2024 09:13:12 +0000 From: Bruce Richardson To: Stephen Hemminger CC: , , , Cheng Jiang , Chengwen Feng , "Yuan Wang" , Morten =?iso-8859-1?Q?Br=F8rup?= , Jiayu Hu Subject: Re: [PATCH v2 10/10] app/test-dma-perf: fix parsing of DMA address Message-ID: References: <20241114001403.147609-1-stephen@networkplumber.org> <20241114192603.41145-1-stephen@networkplumber.org> <20241114192603.41145-11-stephen@networkplumber.org> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20241114192603.41145-11-stephen@networkplumber.org> X-ClientProxiedBy: ZR0P278CA0187.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:44::9) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SA2PR11MB5180:EE_ X-MS-Office365-Filtering-Correlation-Id: b2bdc39a-3c0b-457d-3fbd-08dd0555bedd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1OkjPWF/gOYuO+e6X7siZFcsAgxMZ3F4yUdKphYn6I7JAk6aeW0LASBCNNO5?= =?us-ascii?Q?utcYMJzBT0ml8MKiaRoXORyMG27RbiliNVwHt5dndaaW58mY8t17vq/l8KBF?= =?us-ascii?Q?HZJrJo85p+lIepSRPcwMz91udnPKgQr+MNnVusiCaQ0xgMkHFlcuvR4eimCq?= =?us-ascii?Q?kEEv2VqzCfgt9elLt1/vAyJU3FdIK1m2s+I1mnoXWufoVk0N+ZaRcWEUevUD?= =?us-ascii?Q?geeh/Nm1G6GdwMHC0J9qx7wZMzp1jFkJQlnI09mvs2rg67L6+p570sPW9lDf?= =?us-ascii?Q?EEcStkt7MYPkHRotW+YltdjRgK6kfSyoSqfzVHmur5RBXij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CGO1HdD66M+/sQxp5lwSptlzy4S2UtA8rj+K?= =?us-ascii?Q?xcP5Z7nZl5cyVZn+zeln?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WpQGa075eJQLgPQAMa8TYRy+3/Uvj0I4oKEymmVquy4JZagfIIFkRbRG/ZA1?= =?us-ascii?Q?U8RuxWUeQG57SoruPyqJHEEDWhKeNM2Ea/6iRNxa4BbYYSMSiQQZ5gh3t1WM?= =?us-ascii?Q?oythfOcMKG/sSKiA+o1ApWW+k20gouKkn9iPSB2Ir4p2Spq0TfDkXhPKh1CR?= =?us-ascii?Q?G+8QIF9pYculD2MOyHvo16lP3Xvi8lb3yyynKpxxtpJyB3KnJbyBzsR5rgJ7?= =?us-ascii?Q?0UvIvLyMFFOmosHXuOdmIGyeEeaI0Gy9aUF2/ZraYAfTrRr3xRYA89Z6bKTN?= =?us-ascii?Q?fm6iXRa03Z3oO50GCY75v+HWBWcqVkKf3qgCCWipgei0mDrrRj+e/9OPNHoH?= =?us-ascii?Q?03OGiwmE3BmuLkAyUg6/IoDi5ultcLPArFl6vimon1ehDkkBEFbQEE7b78m6?= =?us-ascii?Q?3qt4n6fBEOwlpzIGAKwL4g+Y0tHYw+kQL+9IsFDMRCmg2kuA0LKTm+vGFY4w?= =?us-ascii?Q?m4pqYalcXk3Hmp6uF7TkceHtrb26D0Vm/N1lWdDw56ABYL92K7PUeu+B/IAw?= =?us-ascii?Q?k14DfC1o9PMbtCq/NEqUT1uVshkMOS1YT2TArPbgExSaMhNdIxUPH4CUCrls?= =?us-ascii?Q?87gTW77sQscrWzVWKiRT5xgtjh8SBbId4vKpPf3+gO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UXEH5896zbsZDKRFhL0hYK0p750x9REnTvu4EE5cEm?= =?us-ascii?Q?tm5w7V3sk1mnjqO5/5pefvf3PXwXcLPCWV6FEaI+QMa8dadGhbgrOhOBwmq+?= =?us-ascii?Q?FA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b2bdc39a-3c0b-457d-3fbd-08dd0555bedd X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2024 09:13:19.1072 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZMHZZcpU6s8amRZO9xl9ml5mzYEG4iVPDL6gXGyodw63TfhSfV8p6hWT8fZ2CjUKHBwDGYBHtlebXiHf2aIEahxdWmHeo9x76ym4tEeUluo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB5180 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Nov 14, 2024 at 11:25:08AM -0800, Stephen Hemminger wrote: > 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 One comment inline below. With that fixed: Acked-by: Bruce Richardson > --- > app/test-dma-perf/main.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c > index 18219918cc..dccb0a3541 100644 > --- a/app/test-dma-perf/main.c > +++ b/app/test-dma-perf/main.c > @@ -217,27 +217,27 @@ parse_lcore_dma(struct test_configure *test_case, const char *value) > struct lcore_dma_map_t *lcore_dma_map; > char *input, *addrs; > char *ptrs[2]; > - char *start, *end, *substr; > + char *start, *end, *substr, *saveptr; > uint16_t lcore_id; > int ret = 0; > > if (test_case == NULL || value == NULL) > return -1; > > - input = strndup(value, strlen(value) + 1); > + input = strdup(value); > if (input == NULL) > return -1; > - addrs = input; > > - while (*addrs == '\0') > - addrs++; > + addrs = input; > + while (isspace(*addrs)) > + ++addrs; > if (*addrs == '\0') { > fprintf(stderr, "No input DMA addresses\n"); > ret = -1; > goto out; > } > > - substr = strtok(addrs, ","); > + substr = strtok_r(addrs, ",", &saveptr); Don't need to use strtok here at all. Just use strchr, and then no need for a new temporary variable. > if (substr == NULL) { > fprintf(stderr, "No input DMA address\n"); > ret = -1; > -- > 2.45.2 >