[PATCH] samples/bpf: Modify the incorrect format specifier

From: liujing
Date: Thu Dec 05 2024 - 21:31:10 EST


Replace %d with %u in snprintf() because it is "unsigned int".

Signed-off-by: liujing <liujing@xxxxxxxxxxxxxxxxxxxx>

diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index 266fdd0b025d..3fc1d37fee7c 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -134,11 +134,11 @@ static void read_route(struct nlmsghdr *nh, int nll)
*((__be32 *)RTA_DATA(rt_attr)));
break;
case RTA_OIF:
- sprintf(ifs, "%u",
+ sprintf(ifs, "%d",
*((int *)RTA_DATA(rt_attr)));
break;
case RTA_METRICS:
- sprintf(metrics, "%u",
+ sprintf(metrics, "%d",
*((int *)RTA_DATA(rt_attr)));
default:
break;
--
2.27.0