Re: [PATCH net] net: add inline annotation to fix the build warning

From: Simon Horman
Date: Thu Sep 19 2024 - 10:56:37 EST


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@xxxxxxxxx>

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