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

From: Moon Yeounsu
Date: Thu Oct 03 2024 - 11:33:30 EST


> sparse is not in the kernel. Feel free to remove it from your hosts.
Oh... I see. Yes, you are right. Sparse is just a program like other
tools like gcc.

>
> $ diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
> index 09e31757e96c7472af2a9dfff7a731d4d076aa11..50fc48c6d0c99d91f5a8eb15c4e3dd0304a83e0b
> 100644
> --- a/net/ipv4/fib_trie.c
> +++ b/net/ipv4/fib_trie.c
> @@ -2888,7 +2888,7 @@ static struct key_vector
> *fib_route_get_idx(struct fib_route_iter *iter,
> }
>
> static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos)
> - __acquires(RCU)
> + __acquires(some_random_stuff)
> {
> struct fib_route_iter *iter = seq->private;
> struct fib_table *tb;
>
>
> $ make C=1 net/ipv4/fib_trie.o
> CALL scripts/checksyscalls.sh
> DESCEND objtool
> INSTALL libsubcmd_headers
> DESCEND bpf/resolve_btfids
> INSTALL libsubcmd_headers
> CC net/ipv4/fib_trie.o
> CHECK net/ipv4/fib_trie.c
>
> No error at all.
> It also does not know about conditional locking, it is quite useless.
Yes, exactly. And It makes me crazy.
`net/ipv6/icmp.c` was written to use the conditional lock as you mentioned.
This is not a problem and can easily be verified intuitively, but
Sparse can't sense it.
To refactor the code to silent `Sparse` is putting the cart before the
horse. NON-SENSE.

So... What do you think about who wants to send the patch to silence
the Sparse's warning message, nevertheless?
I know him who was just about to write the next patch by correcting
mistakes (Seems like he wrote the subject prefix to `net`, not a
`net-next`, what a foolish one).
Is he wasting his life and taking other people's invaluable time? What
do you think about it?