DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Christensen <drc@linux.vnet.ibm.com>
To: dev@dpdk.org
Cc: David Christensen <drc@linux.vnet.ibm.com>, stable@dpdk.org
Subject: [PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le
Date: Wed, 22 Mar 2023 17:24:39 -0400	[thread overview]
Message-ID: <20230322212439.524725-1-drc@linux.vnet.ibm.com> (raw)

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 <drc@linux.vnet.ibm.com>
---
 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 089ac202fa..1f83f49c0e 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.31.1


             reply	other threads:[~2023-03-22 21:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 21:24 David Christensen [this message]
2023-03-22 23:43 ` Stephen Hemminger
2023-03-23 16:45   ` David Christensen
2023-03-23 17:01 ` [PATCH v2] " David Christensen
2023-05-15 23:14   ` Ferruh Yigit
2023-05-15 23:20     ` Stephen Hemminger
2023-05-15 23:35       ` Ferruh Yigit
2023-05-16  1:28         ` Stephen Hemminger
2023-05-16  9:55           ` Ferruh Yigit
2023-06-07 18:47             ` Ferruh Yigit
2023-06-08  2:02               ` Stephen Hemminger
2023-09-29 13:48               ` Ferruh Yigit
2023-10-06 18:31                 ` David Christensen
2023-10-09  9:17                   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322212439.524725-1-drc@linux.vnet.ibm.com \
    --to=drc@linux.vnet.ibm.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).