Skip to content

Commit 17ba793

Browse files
nathanchancekuba-moo
authored andcommitted
phonet/pep: Move call to pn_skb_get_dst_sockaddr() earlier in pep_sock_accept()
A new warning in clang [1] points out a place in pep_sock_accept() where dst is uninitialized then passed as a const pointer to pep_find_pipe(): 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); | ^~~: Move the call to pn_skb_get_dst_sockaddr(), which initializes dst, to before the call to pep_find_pipe(), so that dst is consistently used initialized throughout the function. Cc: [email protected] Fixes: f7ae8d5 ("Phonet: allocate sock from accept syscall rather than soft IRQ") Link: llvm/llvm-project@00dacf8 [1] Closes: ClangBuiltLinux/linux#2101 Signed-off-by: Nathan Chancellor <[email protected]> Link: https://patch.msgid.link/20250715-net-phonet-fix-uninit-const-pointer-v1-1-8efd1bd188b3@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e49f95d commit 17ba793

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/phonet/pep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ static struct sock *pep_sock_accept(struct sock *sk,
826826
}
827827

828828
/* Check for duplicate pipe handle */
829+
pn_skb_get_dst_sockaddr(skb, &dst);
829830
newsk = pep_find_pipe(&pn->hlist, &dst, pipe_handle);
830831
if (unlikely(newsk)) {
831832
__sock_put(newsk);
@@ -850,7 +851,6 @@ static struct sock *pep_sock_accept(struct sock *sk,
850851
newsk->sk_destruct = pipe_destruct;
851852

852853
newpn = pep_sk(newsk);
853-
pn_skb_get_dst_sockaddr(skb, &dst);
854854
pn_skb_get_src_sockaddr(skb, &src);
855855
newpn->pn_sk.sobject = pn_sockaddr_get_object(&dst);
856856
newpn->pn_sk.dobject = pn_sockaddr_get_object(&src);

0 commit comments

Comments
 (0)