Michel Lind 841ac7
From 4cbff6fb763fea892deafbe8a190387bc9d3dbad Mon Sep 17 00:00:00 2001
Michel Lind 841ac7
From: Danielle Ratson <danieller@nvidia.com>
Michel Lind 841ac7
Date: Mon, 12 Aug 2024 17:11:11 +0300
Michel Lind 841ac7
Subject: netlink: settings: Fix lanes parameter format specifier
Michel Lind 841ac7
Michel Lind 841ac7
Lanes parameter is not printed well on ethtool base command causing the
Michel Lind 841ac7
following output:
Michel Lind 841ac7
Michel Lind 841ac7
$ ethtool swp1
Michel Lind 841ac7
Michel Lind 841ac7
[..]
Michel Lind 841ac7
        Speed: 400000Mb/s
Michel Lind 841ac7
Segmentation fault (core dumped)
Michel Lind 841ac7
Michel Lind 841ac7
Use the "%u" format specifier instead of "%s", since the lanes parameter
Michel Lind 841ac7
type is unsigned integer and not a string.
Michel Lind 841ac7
Michel Lind 841ac7
Fixes: bd1341cd2146 ("add json support for base command")
Michel Lind 841ac7
Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Michel Lind 841ac7
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Michel Lind 841ac7
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Michel Lind 841ac7
---
Michel Lind 841ac7
 netlink/settings.c | 2 +-
Michel Lind 841ac7
 1 file changed, 1 insertion(+), 1 deletion(-)
Michel Lind 841ac7
Michel Lind 841ac7
diff --git a/netlink/settings.c b/netlink/settings.c
Michel Lind 841ac7
index 9dd688b..62dd339 100644
Michel Lind 841ac7
--- a/netlink/settings.c
Michel Lind 841ac7
+++ b/netlink/settings.c
Michel Lind 841ac7
@@ -527,7 +527,7 @@ int linkmodes_reply_cb(const struct nlmsghdr *nlhdr, void *data)
Michel Lind 841ac7
 		uint32_t val = mnl_attr_get_u32(tb[ETHTOOL_A_LINKMODES_LANES]);
Michel Lind 841ac7
 
Michel Lind 841ac7
 		print_banner(nlctx);
Michel Lind 841ac7
-		print_uint(PRINT_ANY, "lanes", "\tLanes: %s\n", val);
Michel Lind 841ac7
+		print_uint(PRINT_ANY, "lanes", "\tLanes: %u\n", val);
Michel Lind 841ac7
 	}
Michel Lind 841ac7
 	if (tb[ETHTOOL_A_LINKMODES_DUPLEX]) {
Michel Lind 841ac7
 		uint8_t val = mnl_attr_get_u8(tb[ETHTOOL_A_LINKMODES_DUPLEX]);
Michel Lind 841ac7
-- 
Michel Lind 841ac7
cgit 1.2.3-korg
Michel Lind 841ac7