* [PATCH] net: socket: add missing declaration for update_socket_protocol
@ 2025-11-22 5:10 Chia-Liang Wang
2025-11-22 5:44 ` Kuniyuki Iwashima
0 siblings, 1 reply; 2+ messages in thread
From: Chia-Liang Wang @ 2025-11-22 5:10 UTC (permalink / raw)
To: edumazet, kuniyu, pabeni, willemb, davem, kuba
Cc: horms, netdev, linux-kernel, Chia-Liang Wang
When building with C=1, sparse reports the following warning:
net/socket.c:1735:21: warning: symbol 'update_socket_protocol' was not declared. Should it be static?
The function update_socket_protocol() is defined as __weak, intended
to be overwritten by architecture-specific implementations. Therefore,
it cannot be static.
Add a declaration in include/net/sock.h to fix this sparse warning.
Signed-off-by: Chia-Liang Wang <a0979625527@icloud.com>
---
include/net/sock.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/net/sock.h b/include/net/sock.h
index 60bcb13f045c..2081b6599edc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -3103,4 +3103,6 @@ static inline bool sk_is_readable(struct sock *sk)
return false;
}
+
+int update_socket_protocol(int family, int type, int protocol);
#endif /* _SOCK_H */
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net: socket: add missing declaration for update_socket_protocol
2025-11-22 5:10 [PATCH] net: socket: add missing declaration for update_socket_protocol Chia-Liang Wang
@ 2025-11-22 5:44 ` Kuniyuki Iwashima
0 siblings, 0 replies; 2+ messages in thread
From: Kuniyuki Iwashima @ 2025-11-22 5:44 UTC (permalink / raw)
To: Chia-Liang Wang
Cc: edumazet, pabeni, willemb, davem, kuba, horms, netdev,
linux-kernel, Chia-Liang Wang
On Fri, Nov 21, 2025 at 9:11 PM Chia-Liang Wang <wjliang627@gmail.com> wrote:
>
> When building with C=1, sparse reports the following warning:
>
> net/socket.c:1735:21: warning: symbol 'update_socket_protocol' was not declared. Should it be static?
>
> The function update_socket_protocol() is defined as __weak, intended
> to be overwritten by architecture-specific implementations. Therefore,
> it cannot be static.
>
> Add a declaration in include/net/sock.h to fix this sparse warning.
Sparse just doesn't understand the context.
The function is wrapped with __bpf_hook_start() that
should suppress the real warning by compilers.
>
> Signed-off-by: Chia-Liang Wang <a0979625527@icloud.com>
> ---
> include/net/sock.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 60bcb13f045c..2081b6599edc 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -3103,4 +3103,6 @@ static inline bool sk_is_readable(struct sock *sk)
>
> return false;
> }
> +
> +int update_socket_protocol(int family, int type, int protocol);
> #endif /* _SOCK_H */
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-22 5:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-22 5:10 [PATCH] net: socket: add missing declaration for update_socket_protocol Chia-Liang Wang
2025-11-22 5:44 ` Kuniyuki Iwashima
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®