-Wuninitialized-const-pointer in net/phonet/pep.c
Subsystems (2)
Hi all,
A new warning in clang [1] points out that dst is not initialized when passed to pep_find_pipe() in pep_sock_accept():
net/phonet/pep.c:829:37: error: variable 'dst' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
829 | newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
| ^~~It looks like this was introduced by commit f7ae8d59f661 ("Phonet:
allocate sock from accept syscall rather than soft IRQ") if I understand correctly. Prior to that change, both calls to pep_find_pipe() were in the same function with pn_skb_get_dst_sockaddr(skb, &dst) before them, so dst would always be initialized. Should pn_skb_get_dst_sockaddr() be called before pep_find_pipe() in pep_sock_accept() as well or is there some other fix for this? I am not familiar with this code, hence the inquiry.
[1]: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e
Cheers,
Nathan
From: Nathan Chancellor <[email protected]>
Date: Tue, 15 Jul 2025 13:16:37 -0700
Quoted 9 lines
Hi all,
A new warning in clang [1] points out that dst is not initialized when passed to
pep_find_pipe()inpep_sock_accept():
net/phonet/pep.c:829:37: error: variable 'dst' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]829 | newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle); | ^~~
Quoted 6 lines
It looks like this was introduced by commit
f7ae8d59f661("Phonet:
allocate sock from accept syscall rather than soft IRQ") if I understand correctly. Prior to that change, both calls topep_find_pipe()were in the same function withpn_skb_get_dst_sockaddr(skb, &dst)before them, so dst would always be initialized. Shouldpn_skb_get_dst_sockaddr()be called beforepep_find_pipe()inpep_sock_accept()as well
This sounds good to me, and AFAICT, there's no fix queued for this uninit issue in net.git.
Could you post an official patch ?
Quoted 5 lines
or is there
some other fix for this? I am not familiar with this code, hence the inquiry.[1]: https://github.com/llvm/llvm-project/commit/00dacf8c22f065cb52efb14cd091d441f19b319e