[PATCH net-next] net: use the %px format to display sock

From: kerneljasonxing
Date: Thu May 05 2022 - 09:08:51 EST


From: Jason Xing <xingwanli@xxxxxxxxxxxx>

I found that the current socket address, say 000000009842d952, cannot be
searched in messages because %p format function hashes and converts it
into an unique identifier which is currently useless for debugging.

Signed-off-by: Jason Xing <xingwanli@xxxxxxxxxxxx>
---
net/ipv4/af_inet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 72fde28..b17a4d4 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -139,12 +139,12 @@ void inet_sock_destruct(struct sock *sk)
sk_mem_reclaim_final(sk);

if (sk->sk_type == SOCK_STREAM && sk->sk_state != TCP_CLOSE) {
- pr_err("Attempt to release TCP socket in state %d %p\n",
+ pr_err("Attempt to release TCP socket in state %d %px\n",
sk->sk_state, sk);
return;
}
if (!sock_flag(sk, SOCK_DEAD)) {
- pr_err("Attempt to release alive inet socket %p\n", sk);
+ pr_err("Attempt to release alive inet socket %px\n", sk);
return;
}

--
1.8.3.1