From: XueBing Chen <chenxb_99091@126.com>
To: edumazet@google.com, kuniyu@google.com, pabeni@redhat.com,
willemb@google.com, davem@davemloft.net, kuba@kernel.org,
horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
XueBing Chen <chenxb_99091@126.com>
Subject: [PATCH] net/core/sock: fix coding style issues Fix multiple coding style issues in net/core/sock.c:
Date: Mon, 3 Nov 2025 10:36:53 +0800 [thread overview]
Message-ID: <20251103023653.3843-1-chenxb_99091@126.com> (raw)
- Remove spaces before commas in _sock_locks macro definition
- Use tabs instead of spaces for macro line continuation indentation
- Separate assignment from if condition in __sk_receive_skb function
- Fix pointer declaration format in timer functions
- Add spaces around == operator in preprocessor directive
These changes improve code style compliance with kernel coding standards
without affecting functionality.
Signed-off-by: XueBing Chen <chenxb_99091@126.com>
---
net/core/sock.c | 59 ++++++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 28 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index dc03d4b59..a5dbf6c07 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -223,23 +223,23 @@ static struct lock_class_key af_family_kern_slock_keys[AF_MAX];
*/
#define _sock_locks(x) \
- x "AF_UNSPEC", x "AF_UNIX" , x "AF_INET" , \
- x "AF_AX25" , x "AF_IPX" , x "AF_APPLETALK", \
- x "AF_NETROM", x "AF_BRIDGE" , x "AF_ATMPVC" , \
- x "AF_X25" , x "AF_INET6" , x "AF_ROSE" , \
- x "AF_DECnet", x "AF_NETBEUI" , x "AF_SECURITY" , \
- x "AF_KEY" , x "AF_NETLINK" , x "AF_PACKET" , \
- x "AF_ASH" , x "AF_ECONET" , x "AF_ATMSVC" , \
- x "AF_RDS" , x "AF_SNA" , x "AF_IRDA" , \
- x "AF_PPPOX" , x "AF_WANPIPE" , x "AF_LLC" , \
- x "27" , x "28" , x "AF_CAN" , \
- x "AF_TIPC" , x "AF_BLUETOOTH", x "IUCV" , \
- x "AF_RXRPC" , x "AF_ISDN" , x "AF_PHONET" , \
- x "AF_IEEE802154", x "AF_CAIF" , x "AF_ALG" , \
- x "AF_NFC" , x "AF_VSOCK" , x "AF_KCM" , \
- x "AF_QIPCRTR", x "AF_SMC" , x "AF_XDP" , \
- x "AF_MCTP" , \
- x "AF_MAX"
+ x "AF_UNSPEC", x "AF_UNIX", x "AF_INET", \
+ x "AF_AX25", x "AF_IPX", x "AF_APPLETALK", \
+ x "AF_NETROM", x "AF_BRIDGE", x "AF_ATMPVC", \
+ x "AF_X25", x "AF_INET6", x "AF_ROSE", \
+ x "AF_DECnet", x "AF_NETBEUI", x "AF_SECURITY", \
+ x "AF_KEY", x "AF_NETLINK", x "AF_PACKET", \
+ x "AF_ASH", x "AF_ECONET", x "AF_ATMSVC", \
+ x "AF_RDS", x "AF_SNA", x "AF_IRDA", \
+ x "AF_PPPOX", x "AF_WANPIPE", x "AF_LLC", \
+ x "27", x "28", x "AF_CAN", \
+ x "AF_TIPC", x "AF_BLUETOOTH", x "IUCV", \
+ x "AF_RXRPC", x "AF_ISDN", x "AF_PHONET", \
+ x "AF_IEEE802154", x "AF_CAIF", x "AF_ALG", \
+ x "AF_NFC", x "AF_VSOCK", x "AF_KCM", \
+ x "AF_QIPCRTR", x "AF_SMC", x "AF_XDP", \
+ x "AF_MCTP", \
+ x "AF_MAX"
static const char *const af_family_key_strings[AF_MAX+1] = {
_sock_locks("sk_lock-")
@@ -579,14 +579,17 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
rc = sk_backlog_rcv(sk, skb);
mutex_release(&sk->sk_lock.dep_map, _RET_IP_);
- } else if ((err = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)))) {
- bh_unlock_sock(sk);
- if (err == -ENOMEM)
- reason = SKB_DROP_REASON_PFMEMALLOC;
- if (err == -ENOBUFS)
- reason = SKB_DROP_REASON_SOCKET_BACKLOG;
- sk_drops_inc(sk);
- goto discard_and_relse;
+ } else {
+ err = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf));
+ if (err) {
+ bh_unlock_sock(sk);
+ if (err == -ENOMEM)
+ reason = SKB_DROP_REASON_PFMEMALLOC;
+ if (err == -ENOBUFS)
+ reason = SKB_DROP_REASON_SOCKET_BACKLOG;
+ sk_drops_inc(sk);
+ goto discard_and_relse;
+ }
}
bh_unlock_sock(sk);
@@ -3611,7 +3614,7 @@ void sk_send_sigurg(struct sock *sk)
}
EXPORT_SYMBOL(sk_send_sigurg);
-void sk_reset_timer(struct sock *sk, struct timer_list* timer,
+void sk_reset_timer(struct sock *sk, struct timer_list *timer,
unsigned long expires)
{
if (!mod_timer(timer, expires))
@@ -3619,7 +3622,7 @@ void sk_reset_timer(struct sock *sk, struct timer_list* timer,
}
EXPORT_SYMBOL(sk_reset_timer);
-void sk_stop_timer(struct sock *sk, struct timer_list* timer)
+void sk_stop_timer(struct sock *sk, struct timer_list *timer)
{
if (timer_delete(timer))
__sock_put(sk);
@@ -3678,7 +3681,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
sk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
sk->sk_stamp = SK_DEFAULT_STAMP;
-#if BITS_PER_LONG==32
+#if BITS_PER_LONG == 32
seqlock_init(&sk->sk_stamp_seq);
#endif
atomic_set(&sk->sk_zckey, 0);
--
2.17.1
next reply other threads:[~2025-11-03 3:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 2:36 XueBing Chen [this message]
2025-11-04 1:26 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251103023653.3843-1-chenxb_99091@126.com \
--to=chenxb_99091@126.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®