Fix netdevsim switch_id display truncation
Subsystems (2)
PATCH 1/1 Fix netdevsim switch_id display truncation
Problem:
The ip -d link show sim0 against of netdevsim interface, the switchid only has 62 chars. The kernel struct netdev_phys_item_id confirmed the switch id is 32 bytes which should produces 64 hex chars.
Root cause:
When print_linkinfo() showing switchid, it invokes hexstring_n2a() which output hex string to SPRINT_BUF(b1) including trailing NULL. The 32 bytes binary need 65 chars including trailing NULL while SPRINT_BUF is 64 chars.
Fix:
Bump SPRINT_BSIZE from 64 to 128.
Signed-off-by Gris Ge <[email protected]>
--- include/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/utils.h +1 -1
@@ -39,7 +39,7 @@ extern bool do_all;extern int echo_request;extern int use_iec; -#define SPRINT_BSIZE 64 +#define SPRINT_BSIZE 128#define SPRINT_BUF (x) char x[SPRINT_BSIZE]void incomplete_command (void ) __attribute__((noreturn));
Signature · 1 line
2.55.0