llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* -Wuninitialized-const-pointer in net/phonet/pep.c
@ 2025-07-15 20:16 Nathan Chancellor
  2025-07-15 22:14 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2025-07-15 20:16 UTC (permalink / raw)
  To: Remi Denis-Courmont, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: netdev, llvm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: -Wuninitialized-const-pointer in net/phonet/pep.c
  2025-07-15 20:16 -Wuninitialized-const-pointer in net/phonet/pep.c Nathan Chancellor
@ 2025-07-15 22:14 ` Kuniyuki Iwashima
  0 siblings, 0 replies; 2+ messages in thread
From: Kuniyuki Iwashima @ 2025-07-15 22:14 UTC (permalink / raw)
  To: nathan; +Cc: courmisch, davem, edumazet, horms, kuba, llvm, netdev, pabeni

From: Nathan Chancellor <nathan@kernel.org>
Date: Tue, 15 Jul 2025 13:16:37 -0700
> 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

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 ?


> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-15 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15 20:16 -Wuninitialized-const-pointer in net/phonet/pep.c Nathan Chancellor
2025-07-15 22:14 ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).