[PATCH master] tlv: drop assigned MAC addresses from fixup

Ahmad Fatoum a.fatoum at barebox.org
Tue Aug 5 11:53:44 PDT 2025


A TLV blob may contain more MAC addresses than barebox can assign for
the network devices it knows about. In that case, barebox should assign
as many MAC addresses as it can and fix up the remainder, so the OS can
deal with it.

This got broken during refactoring in reply to upstreaming feedback:
instead of calling string_to_ethaddr on a string, it was called on a
6-byte MAC address.

Swap this to get back the intended behavior.

Fixes: 0b444f05f713 ("common: add barebox TLV support")
Link: https://github.com/linux-automation/meta-lxatac/issues/275
Reported-by: Leonard Göhrs <l.goehrs at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 common/tlv/parser.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/tlv/parser.c b/common/tlv/parser.c
index 468eeafceda1..fc46092650b1 100644
--- a/common/tlv/parser.c
+++ b/common/tlv/parser.c
@@ -95,8 +95,8 @@ int of_tlv_fixup(struct device_node *root, void *ctx)
 
 	list_for_each_entry(addr, &ethaddr_list, list) {
 		char propname[sizeof("address-4294967295")];
-		const u8 *enetaddr_a;
-		u8 enetaddr_b[ETH_ALEN];
+		const char *enetaddr_tlv_str;
+		u8 enetaddr_tlv[ETH_ALEN];
 		struct property *pp;
 
 		if (!eth_of_get_fixup_node(root, NULL, addr->ethid))
@@ -107,11 +107,11 @@ int of_tlv_fixup(struct device_node *root, void *ctx)
 		if (!pp)
 			continue;
 
-		enetaddr_a = of_property_get_value(pp);
-		if (string_to_ethaddr(addr->ethaddr, enetaddr_b))
+		enetaddr_tlv_str = of_property_get_value(pp);
+		if (string_to_ethaddr(enetaddr_tlv_str, enetaddr_tlv))
 			continue;
 
-		if (memcmp(enetaddr_a, enetaddr_b, ETH_ALEN))
+		if (memcmp(enetaddr_tlv, addr->ethaddr, ETH_ALEN))
 			continue;
 
 		of_delete_property(pp);
-- 
2.39.5




More information about the barebox mailing list