patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v3 4/4] net/tap: use rte_ether_unformat_address
       [not found] ` <20231003202909.391330-1-stephen@networkplumber.org>
@ 2023-10-03 20:29   ` Stephen Hemminger
  2023-10-11 14:25     ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2023-10-03 20:29 UTC (permalink / raw)
  To: dev; +Cc: David Christensen, stable, Stephen Hemminger

From: David Christensen <drc@linux.vnet.ibm.com>

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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v3 4/4] net/tap: use rte_ether_unformat_address
  2023-10-03 20:29   ` [PATCH v3 4/4] net/tap: use rte_ether_unformat_address Stephen Hemminger
@ 2023-10-11 14:25     ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2023-10-11 14:25 UTC (permalink / raw)
  To: Stephen Hemminger, dev, David Marchand
  Cc: David Christensen, stable, Thomas Monjalon

On 10/3/2023 9:29 PM, Stephen Hemminger wrote:
> From: David Christensen <drc@linux.vnet.ibm.com>
> 
> 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
>

For record, this should be 1195, caught by David:
Bugzilla ID: 1195



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-11 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230929163611.62691-1-stephen@networkplumber.org>
     [not found] ` <20231003202909.391330-1-stephen@networkplumber.org>
2023-10-03 20:29   ` [PATCH v3 4/4] net/tap: use rte_ether_unformat_address Stephen Hemminger
2023-10-11 14:25     ` Ferruh Yigit

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).