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 D639A426AE; Tue, 3 Oct 2023 18:34:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE4C1402A2; Tue, 3 Oct 2023 18:34:45 +0200 (CEST) Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by mails.dpdk.org (Postfix) with ESMTP id 5E63E40262 for ; Tue, 3 Oct 2023 18:34:44 +0200 (CEST) Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3af5b26d599so785308b6e.2 for ; Tue, 03 Oct 2023 09:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1696350883; x=1696955683; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=R2is6C0WEz/0cqdBc0JeTJE21FH8KzpUcxjzrCzGrns=; b=YQf584wy5zgf7eV/9azdxyuB0nJ/MpMPfYj3xkoGUMogt2utHpPBLeCVks3HHfGZoC Nc4JgnixhohsIMW7xhg/jH5CWESV0clc6H1DhY+KJ/b67WEiGPw3YfRPsolOmu/9P6k2 kJDf626gLqrXgJpzGprpuVaY2vd94yM7o0x8smY+y1X9Hmm5LdIKx0DvnKCX3KERvh/P H2RkUWOniEcVGbANujVpNOQBVm36eUbX8PnQxEa32kmFgk6kYQLmxHv3ZW/9dx+70RsB G0cK6eeCCM5Z227GQwTeTVj9CVu1dl5W29cJUMR4v8Op3SsAWb+YNkOT85JefwBphCnd y4Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696350883; x=1696955683; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R2is6C0WEz/0cqdBc0JeTJE21FH8KzpUcxjzrCzGrns=; b=wtRI/2Puegy0THAWAJyXBNIbYp18nKCKMiLeeMCOnag4lWLBVZuvO9uaZ2L9SFFLwA tldhEHIYQVl/wZ3a3LfB+CWIQowv2wkvZR8MAHux6r0oducIaUtblUHZpsqAxRLoRHrl u6FGsMAKPH427OfzTNtAXHAfrGU9DZ8AZFbNnXa4FQ522Z0VLQuIkOAN1YSMbOtEk8Jr vKjBkE0O6tZKShHyR+e3etV/9aroqMKJlIGKveQ2J8UEdRg6mxa+Ln/yyKzB7OCpRmN9 O5G/1SKkliHFOcIl35fyqDh4tcW1vnoay6gTPYhcn1XwrGqVAi+CwKMvuU3ZAfxMELPF 6Vug== X-Gm-Message-State: AOJu0YwFblUfUxm/nEGBfAFVXDBJw4BaWNbB4a8FjlwwB0JrD9swO7xc +jh3JAgfImm7DByb+XZdUhdLGw== X-Google-Smtp-Source: AGHT+IGG5kPeaapmhPSFPSkWR2gTRvsfwgHiDZv0aEQ4FFnS/mkO9+7UwEvYQwTzVW+rRUZ+oYq5Wg== X-Received: by 2002:a05:6808:1391:b0:3ab:85a1:fb04 with SMTP id c17-20020a056808139100b003ab85a1fb04mr150243oiw.9.1696350883625; Tue, 03 Oct 2023 09:34:43 -0700 (PDT) Received: from hermes.local (204-195-126-68.wavecable.com. [204.195.126.68]) by smtp.gmail.com with ESMTPSA id o28-20020a637e5c000000b00584b293d157sm1563507pgn.80.2023.10.03.09.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 09:34:43 -0700 (PDT) Date: Tue, 3 Oct 2023 09:34:41 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: dev@dpdk.org Subject: Re: [PATCH v2 0/3] rte_ether_unformat_addr changes Message-ID: <20231003093441.75f4874d@hermes.local> In-Reply-To: <1cba5fee-2283-422e-abda-4cc7f239d5d8@amd.com> References: <20230929163611.62691-1-stephen@networkplumber.org> <20231002183730.301163-1-stephen@networkplumber.org> <1cba5fee-2283-422e-abda-4cc7f239d5d8@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 Tue, 3 Oct 2023 11:44:16 +0100 Ferruh Yigit wrote: > On 10/2/2023 7:37 PM, Stephen Hemminger wrote: > > This patchset makes rte_ether_unformat_addr allow other formats > > for MAC address. Need to remove some inputs from existing > > cmdline_etheraddr test, and add a new test in test suite > > to cover this. There is some overlap between the two tests > > but that is fine. > >=20 > > Stephen Hemminger (3): > > test: remove some strings from cmdline_etheraddr tests > > rte_ether_unformat: accept more inputs > > test: add tests for rte_ether routines > > =20 >=20 > Thanks Stephen, >=20 > This enables using the API as replacement to the tap PMD's local parse > implementation: > https://patchwork.dpdk.org/project/dpdk/patch/20230323170145.129901-1-drc= @linux.vnet.ibm.com/ It can be simplified to just this. No need to check value =3D=3D NULL, already checkd. No need to check for user_mac =3D=3D NULL, since only called one place and = that place passes pointer to stack variable. =46rom b478a17f13a1bedadca3b60608c585f31c9ad8f2 Mon Sep 17 00:00:00 2001 From: David Christensen Date: Thu, 23 Mar 2023 13:01:45 -0400 Subject: [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le Building DPDK with gcc 12 on a ppc64le system generates a stringop-overflow warning. Replace the local MAC address validation function parse_user_mac() with a call to rte_ether_unformat_addr() instead. Bugzilla ID: 1197 Cc: stable@dpdk.org Signed-off-by: David Christensen --- drivers/net/tap/rte_eth_tap.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index bf98f7555990..b25a52655fa2 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2267,29 +2267,6 @@ set_remote_iface(const char *key __rte_unused, return 0; } =20 -static int parse_user_mac(struct rte_ether_addr *user_mac, - const char *value) -{ - unsigned int index =3D 0; - char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte =3D NULL; - - if (user_mac =3D=3D NULL || value =3D=3D NULL) - return 0; - - strlcpy(mac_temp, value, sizeof(mac_temp)); - mac_byte =3D strtok(mac_temp, ":"); - - while ((mac_byte !=3D NULL) && - (strlen(mac_byte) <=3D 2) && - (strlen(mac_byte) =3D=3D strspn(mac_byte, - ETH_TAP_CMP_MAC_FMT))) { - user_mac->addr_bytes[index++] =3D strtoul(mac_byte, NULL, 16); - mac_byte =3D strtok(NULL, ":"); - } - - return index; -} - static int set_mac_type(const char *key __rte_unused, const char *value, @@ -2311,7 +2288,7 @@ set_mac_type(const char *key __rte_unused, goto success; } =20 - if (parse_user_mac(user_mac, value) !=3D 6) + if (rte_ether_unformat_addr(value, user_mac) < 0) goto error; success: TAP_LOG(DEBUG, "TAP user MAC param (%s)", value); --=20 2.39.2