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 CF04A426B2; Tue, 3 Oct 2023 22:29:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E11FB40A7F; Tue, 3 Oct 2023 22:29:26 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 512B6406B4 for ; Tue, 3 Oct 2023 22:29:24 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1c60f1a2652so1970085ad.0 for ; Tue, 03 Oct 2023 13:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1696364963; x=1696969763; 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=vwwODn05ke3sSauHLybwTs8ZNGKb1GSkj9OLdb3j6cc=; b=Bhrw33zmW7V4wj8/MDQl4GkCeOCn8dcOEbbq3qvEceGpw8a++40rJ0B8RVJUUv/ioY rvOKNswhvCM/hb5AjtH9E7+eB25+l++Jsjq3wkY6DD3JHqmQzD14oQeSCIjCGjH9X6ap 0RgFI7dCg3e5rl5fG9j9b/OoJ2gUr+SC2N+d/6hrXoEcdbpDAQwgu2nxCT7IZcyPHWkY QPFiI7hrCJnFaX7xFY9OxVZym42QQCB6zm4F5BharB0w0kSLNqcUTJbkaGufqqILiHlh R8a/9Ejenmy4rkUkU3ZMY2gwutSYnwSRGBlSYQo1V2PMOUoWsBHqpfRyEFAbff4qL6aO vRtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696364963; x=1696969763; 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=vwwODn05ke3sSauHLybwTs8ZNGKb1GSkj9OLdb3j6cc=; b=aWUAGFeeVgriND86y64Y7nAy0OPh/Fm2/T81FFpa/b8h1tyIpj2trG5gi/idXuhAXX yA4THMUWu3uUvqPlKLrVo2mZQB9AtBcmZwIuxd8rJ2QI+Lnk/zdmCiz9a5nCtpY9FiGK z+Um5ezqVj93GOD0WghFdTJcNCInWTcw5uSGR3lArW2OvigqOo7hQzdKZNrIHELKsK1U YxKUiQ2QiWrzRvVyyXZkYIWsCpA6LZK4LvAVNZlSUEBXH56qXAnBAYvUMoO/l1TnWqkA IEOMR+jWN8IoRonFk+v539sWOG9eWZwH3a8fbGh6016NNgY+AwRBunKd+HF0Qu6ThxqW +oFg== X-Gm-Message-State: AOJu0Ywg+YhoFLl4/S+OX2POdnTmXBjl9J0Is3PflEPC8BnIQMMEmLqF g5nOmyFzIbytoWbCSgtgrDiQ1ZduHJrBLGoRIwc= X-Google-Smtp-Source: AGHT+IH/+w7JMdZfroA5z7pcMVfThkovmoaBNdcEQHA82PsY7Nl1GVm1xFkrywIgJnIHjT4FddDv9Q== X-Received: by 2002:a17:902:f7ce:b0:1c7:47f4:7c86 with SMTP id h14-20020a170902f7ce00b001c747f47c86mr468696plw.15.1696364963279; Tue, 03 Oct 2023 13:29:23 -0700 (PDT) Received: from hermes.local (204-195-126-68.wavecable.com. [204.195.126.68]) by smtp.gmail.com with ESMTPSA id a11-20020a1709027d8b00b001c5f62a639asm2014138plm.196.2023.10.03.13.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 13:29:22 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: David Christensen , stable@dpdk.org, Stephen Hemminger Subject: [PATCH v3 4/4] net/tap: use rte_ether_unformat_address Date: Tue, 3 Oct 2023 13:29:09 -0700 Message-Id: <20231003202909.391330-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003202909.391330-1-stephen@networkplumber.org> References: <20230929163611.62691-1-stephen@networkplumber.org> <20231003202909.391330-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: David Christensen 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 Signed-off-by: Stephen Hemminger --- 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; } -static int parse_user_mac(struct rte_ether_addr *user_mac, - const char *value) -{ - unsigned int index = 0; - char mac_temp[strlen(ETH_TAP_USR_MAC_FMT) + 1], *mac_byte = NULL; - - if (user_mac == NULL || value == NULL) - return 0; - - strlcpy(mac_temp, value, sizeof(mac_temp)); - mac_byte = strtok(mac_temp, ":"); - - while ((mac_byte != NULL) && - (strlen(mac_byte) <= 2) && - (strlen(mac_byte) == strspn(mac_byte, - ETH_TAP_CMP_MAC_FMT))) { - user_mac->addr_bytes[index++] = strtoul(mac_byte, NULL, 16); - mac_byte = 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; } - if (parse_user_mac(user_mac, value) != 6) + if (rte_ether_unformat_addr(value, user_mac) < 0) goto error; success: TAP_LOG(DEBUG, "TAP user MAC param (%s)", value); -- 2.39.2