net/ipv6/icmp.c | 2 ++ 1 file changed, 2 insertions(+)
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
On Thu, Sep 19, 2024 at 11:21:49PM +0900, Moon Yeounsu wrote: > 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> Hi Moon, Without this patch applied I see the warnings cited above. However, with this patch applied, I see the following. So I think this needs more work. net/ipv6/icmp.c: note: in included file (through include/linux/sched.h, include/linux/percpu.h, arch/x86/include/asm/msr.h, arch/x86/include/asm/tsc.h, arch/x86/include/asm/timex.h, include/linux/timex.h, ...): ./include/linux/spinlock.h:361:16: warning: context imbalance in 'icmpv6_xmit_lock' - different lock contexts for basic block net/ipv6/icmp.c: note: in included file (through include/linux/spinlock.h, include/linux/sched.h, include/linux/percpu.h, arch/x86/include/asm/msr.h, arch/x86/include/asm/tsc.h, arch/x86/include/asm/timex.h, ...): ./include/linux/bottom_half.h:33:30: warning: context imbalance in 'icmp6_send' - different lock contexts for basic block ./include/linux/bottom_half.h:33:30: warning: context imbalance in 'icmpv6_echo_reply' - different lock contexts for basic block Also, It is my feeling that addressing warnings of this nature is not a fix for net, but rather but rather an enhancement for net-next. net-next is currently closed for the v6.12 merge windows, so non-RFC, patches should not be posted for net-next until it re-opens once v6.12-rc1 has been released, most likely during the week of 30th September. -- pw-bot: changes-requested
On Thu, Sep 19, 2024 at 11:56 PM Simon Horman <horms@kernel.org> wrote: > Hi Moon, > > Without this patch applied I see the warnings cited above. > > However, with this patch applied, I see the following. > So I think this needs more work. Okay, I'll fix and update. (Of course, patch after release `-rc1`) > net-next is currently closed for the v6.12 merge windows, so non-RFC, > patches should not be posted for net-next until it re-opens once v6.12-rc1 > has been released, most likely during the week of 30th September. Thank you for letting me know : ) During this time, I'll read patches, docs, and code to increase my sense. I appreciate you reviewing my patch!
© 2016 - 2024 Red Hat, Inc.