[PATCH] net/tap: resolve stringop-overflow with gcc 12 on ppc64le

David Christensen drc at linux.vnet.ibm.com
Thu Mar 23 17:45:54 CET 2023


On 3/22/23 4:43 PM, Stephen Hemminger wrote:
>>   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);
> 
> There might still be case where user_mac == NULL since it comes
> from extra_args.

Ok, I'll fix in v2.

> Also, this code has this suspicious code:
> 
> 	if (!strncasecmp(ETH_TAP_MAC_FIXED, value, strlen(ETH_TAP_MAC_FIXED))) {
> 		static int iface_idx;
> 
> 		/* fixed mac = 00:64:74:61:70:<iface_idx> */
> 		memcpy((char *)user_mac->addr_bytes, "\0dtap",
> 			RTE_ETHER_ADDR_LEN);
> 		user_mac->addr_bytes[RTE_ETHER_ADDR_LEN - 1] =
> 			iface_idx++ + '0';
> 		goto success;
> 	}
> 
> The OUI for that MAC address is not registered but it might be someday.
> Choosing magic constants in IANA assigned space is not best practice.
> Unless some vendor wants to spend lots of time registering these.
> 
> Better to use locally assigned value.  See RFC7042 for more details.

I think that's out of scope for this issue.  Opened a DPDK Bugzilla to 
document the concern which changes "\0dtap" to "\002dtap" to set the 
local bit as required by the RFC.  I'll send out the patch for code and 
documentation after 23.03 is released.

Dave


More information about the stable mailing list