Skip to contentSkip to conversation

netlink: settings: Fix lanes parameter format specifier

PATCH New Danielle Ratson 1 participant 1 message Aug 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: settings: Fix lanes parameter format specifier

Lanes parameter is not printed well on ethtool base command causing the following output:

$ ethtool swp1

[..]

        Speed: 400000Mb/s

Segmentation fault (core dumped)

Use the "%u" format specifier instead of "%s", since the lanes parameter type is unsigned integer and not a string.

Fixes bd1341cd2146 ("add json support for base command")
---
 netlink/settings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
netlink/settings.c +1 -1
index 9dd688b..62dd339 100644
@@ -527,7 +527,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data)
 		uint32_t val = mnl_attr_get_u32(tb[ETHTOOL_A_LINKMODES_LANES]);
 
 		print_banner(nlctx);
-		print_uint(PRINT_ANY, "lanes", "\tLanes: %s\n", val);
+		print_uint(PRINT_ANY, "lanes", "\tLanes: %u\n", val);
 	}
 	if (tb[ETHTOOL_A_LINKMODES_DUPLEX]) {
 		uint8_t val = mnl_attr_get_u8(tb[ETHTOOL_A_LINKMODES_DUPLEX]);
Signature · 1 line
2.45.0