net: Treat sock->sk_drops as an unsigned int when printing
Subsystems (4)
PATCH 1/1 net: Treat sock->sk_drops as an unsigned int when printing
Currently, procfs socket stats format sk_drops as a signed int (%d). For large values this will cause a negative number to be printed.
We know the drop count can never be a negative so change the format specifier to %u.
Signed-off-by Patrick Talbert <[email protected]>
--- net/ipv4/ping.c | 2 +- net/ipv4/raw.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/datagram.c | 2 +- net/netlink/af_netlink.c | 2 +- net/phonet/socket.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/ping.c +1 -1
@@ -1113,7 +1113,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,__u16 srcp =ntohs (inet->inet_sport); seq_printf(f, "%5d: %08X:%04X %08X:%04X" - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d", + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u", bucket, src, srcp, dest, destp, sp->sk_state, sk_wmem_alloc_get(sp), sk_rmem_alloc_get(sp),
net/ipv4/raw.c +1 -1
@@ -1076,7 +1076,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i) srcp = inet->inet_num; seq_printf(seq, "%4d: %08X:%04X %08X:%04X" - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n", + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n", i, src, srcp, dest, destp, sp->sk_state, sk_wmem_alloc_get(sp), sk_rmem_alloc_get(sp),
net/ipv4/udp.c +1 -1
@@ -2883,7 +2883,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,__u16 srcp =ntohs (inet->inet_sport); seq_printf(f, "%5d: %08X:%04X %08X:%04X" - " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d", + " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u", bucket, src, srcp, dest, destp, sp->sk_state, sk_wmem_alloc_get(sp), udp_rqueue_get(sp),
net/ipv6/datagram.c +1 -1
@@ -1034,7 +1034,7 @@ void __ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp, src = &sp->sk_v6_rcv_saddr; seq_printf(seq, "%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " - "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n", + "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %u\n", bucket, src->s6_addr32[0], src->s6_addr32[1], src->s6_addr32[2], src->s6_addr32[3], srcp,
net/netlink/af_netlink.c +1 -1
@@ -2642,7 +2642,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v)struct sock *s = v;struct netlink_sock *nlk =nlk_sk (s); - seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8d %-8lu\n", + seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8u %-8lu\n", s, s->sk_protocol, nlk->portid,
net/phonet/socket.c +1 -1
@@ -607,7 +607,7 @@ static int pn_sock_seq_show(struct seq_file *seq, void *v)struct pn_sock *pn =pn_sk (sk); seq_printf(seq, "%2d %04X:%04X:%02X %02X %08X:%08X %5d %lu " - "%d %pK %d", + "%d %pK %u", sk->sk_protocol, pn->sobject, pn->dobject, pn->resource, sk->sk_state, sk_wmem_alloc_get(sk), sk_rmem_alloc_get(sk),
Signature · 1 line
2.18.1
David Miller
maintainerFrom: Patrick Talbert <[email protected]>
Date: Fri, 17 May 2019 17:11:28 +0200
Quoted 7 lines
Currently, procfs socket stats format
sk_dropsas a signed int (%d). For large values this will cause a negative number to be printed.We know the drop count can never be a negative so change the format specifier to %u.
Signed-off-by Patrick Talbert <[email protected]>
Yep, looks reasonable, applied.