From: Kuniyuki Iwashima <kuniyu@google.com>
To: nathan@kernel.org
Cc: courmisch@gmail.com, davem@davemloft.net, edumazet@google.com,
horms@kernel.org, kuba@kernel.org, llvm@lists.linux.dev,
netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: -Wuninitialized-const-pointer in net/phonet/pep.c
Date: Tue, 15 Jul 2025 22:14:01 +0000 [thread overview]
Message-ID: <20250715221403.1339526-1-kuniyu@google.com> (raw)
In-Reply-To: <20250715201637.GA2104822@ax162>
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
prev parent reply other threads:[~2025-07-15 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 20:16 -Wuninitialized-const-pointer in net/phonet/pep.c Nathan Chancellor
2025-07-15 22:14 ` Kuniyuki Iwashima [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250715221403.1339526-1-kuniyu@google.com \
--to=kuniyu@google.com \
--cc=courmisch@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).