netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: add inline annotation to fix the build warning
@ 2024-09-19 14:21 Moon Yeounsu
  2024-09-19 14:56 ` Simon Horman
  0 siblings, 1 reply; 10+ messages in thread
From: Moon Yeounsu @ 2024-09-19 14:21 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel, Moon Yeounsu

This patch fixes two sparse warnings (`make C=1`):
net/ipv6/icmp.c:103:20: warning: context imbalance in 'icmpv6_xmit_lock' - wrong count at exit
net/ipv6/icmp.c:119:13: warning: context imbalance in 'icmpv6_xmit_unlock' - unexpected unlock

Since `icmp6_xmit_lock()` and `icmp6_xmit_unlock()` are designed as they
are named, entering/returning the function without lock/unlock doesn't
matter.

Signed-off-by: Moon Yeounsu <yyyynoom@gmail.com>
---
 net/ipv6/icmp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 071b0bc1179d..d8cc3d63c942 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -101,6 +101,7 @@ static const struct inet6_protocol icmpv6_protocol = {
 
 /* Called with BH disabled */
 static struct sock *icmpv6_xmit_lock(struct net *net)
+	__acquires(&sk->sk_lock.slock)
 {
 	struct sock *sk;
 
@@ -117,6 +118,7 @@ static struct sock *icmpv6_xmit_lock(struct net *net)
 }
 
 static void icmpv6_xmit_unlock(struct sock *sk)
+	__releases(&sk->sk_lock.slock)
 {
 	sock_net_set(sk, &init_net);
 	spin_unlock(&sk->sk_lock.slock);
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH net] net: add inline annotation to fix the build warning
@ 2024-10-01 19:33 Moon Yeounsu
       [not found] ` <CAAjsZQx1NFdx8HyBmDqDxQbUvcxbaag5y-ft+feWLgQeb1Qfdw@mail.gmail.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Moon Yeounsu @ 2024-10-01 19:33 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, linux, j.granados, judyhsiao,
	James.Z.Li
  Cc: netdev, linux-kernel, Moon Yeounsu

This patch fixes two `sparse` warnings:
net/core/neighbour.c:453:9: warning: context imbalance in '__neigh_ifdown' - wrong count at exit
net/core/neighbour.c:871:9: warning: context imbalance in 'pneigh_ifdown_and_unlock' - unexpected unlock

You can check it by running:
`make C=1 net/core/neighbour.o`

Signed-off-by: Moon Yeounsu <yyyynoom@gmail.com>
---
 net/core/neighbour.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 77b819cd995b..6b5ec9a44556 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -441,6 +441,7 @@ EXPORT_SYMBOL(neigh_changeaddr);
 
 static int __neigh_ifdown(struct neigh_table *tbl, struct net_device *dev,
 			  bool skip_perm)
+	__acquires(&tbl->lock)
 {
 	write_lock_bh(&tbl->lock);
 	neigh_flush_dev(tbl, dev, skip_perm);
@@ -453,6 +454,7 @@ static int __neigh_ifdown(struct neigh_table *tbl, struct net_device *dev,
 }
 
 int neigh_carrier_down(struct neigh_table *tbl, struct net_device *dev)
+	__acquires(&tbl->lock)
 {
 	__neigh_ifdown(tbl, dev, true);
 	return 0;
@@ -460,6 +462,7 @@ int neigh_carrier_down(struct neigh_table *tbl, struct net_device *dev)
 EXPORT_SYMBOL(neigh_carrier_down);
 
 int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev)
+	__acquires(&tbl->lock)
 {
 	__neigh_ifdown(tbl, dev, false);
 	return 0;
@@ -848,6 +851,7 @@ int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey,
 
 static int pneigh_ifdown_and_unlock(struct neigh_table *tbl,
 				    struct net_device *dev)
+	__releases(&tbl->lock)
 {
 	struct pneigh_entry *n, **np, *freelist = NULL;
 	u32 h;
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-03 18:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-19 14:21 [PATCH net] net: add inline annotation to fix the build warning Moon Yeounsu
2024-09-19 14:56 ` Simon Horman
2024-09-20  7:27   ` Moon Yeounsu
  -- strict thread matches above, loose matches on Subject: below --
2024-10-01 19:33 Moon Yeounsu
     [not found] ` <CAAjsZQx1NFdx8HyBmDqDxQbUvcxbaag5y-ft+feWLgQeb1Qfdw@mail.gmail.com>
2024-10-02 14:41   ` Eric Dumazet
2024-10-03 13:56     ` Moon Yeounsu
2024-10-03 14:19       ` Eric Dumazet
2024-10-03 15:33         ` Moon Yeounsu
2024-10-03 16:11           ` Edward Cree
2024-10-03 18:39             ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).