From: Dan Carpenter <dan.carpenter@linaro.org>
To: Antonio Quartulli <antonio@mandelbit.com>
Cc: Sergey Bashirov <sergeybashirov@gmail.com>,
linux-nfs@vger.kernel.org, Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Konstantin Evtushenko <koevtushenko@yandex.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pNFS: fix uninitialized pointer access
Date: Thu, 17 Jul 2025 17:02:32 +0300 [thread overview]
Message-ID: <90cddfa9-2d0c-4806-b3df-6a5ddd13c97f@suswa.mountain> (raw)
In-Reply-To: <d9b026f1-6ed3-41ca-8699-914c45b0339b@mandelbit.com>
On Thu, Jul 17, 2025 at 10:01:42AM +0200, Antonio Quartulli wrote:
>
> I agree a comment would help.
>
> > Another option would be to initialize the be_prev to NULL. This will
> > silence the uninitialized variable warning.
>
> But will likely trigger a potential NULL-ptr-deref, because the static
> analyzer believes we can get there with count==0.
>
I don't know how Coverity does this. In my experience, writing Smatch
I had to treat initializations to NULL as "ignore this variable". We
used to have an uninitialized_var() macro to silence uninitialized
variables. It did an assignment to itself something like:
#define uninitialized_var(x) x = x
But we removed it and changed all those places to just initialize the
variables to zero.
Even before, initializing things to zero was the standard way to silence
GCC uninitialized variable warnings, so warning about NULL pointer
dereferences tended to be prone to false positives and the worst kind of
really complicated false positives too.
regards,
dan carpenter
prev parent reply other threads:[~2025-07-17 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 14:38 Antonio Quartulli
2025-07-17 0:27 ` Sergey Bashirov
2025-07-17 4:56 ` Dan Carpenter
2025-07-17 8:01 ` Antonio Quartulli
2025-07-17 8:50 ` Sergey Bashirov
2025-07-17 14:02 ` Dan Carpenter [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=90cddfa9-2d0c-4806-b3df-6a5ddd13c97f@suswa.mountain \
--to=dan.carpenter@linaro.org \
--cc=anna@kernel.org \
--cc=antonio@mandelbit.com \
--cc=koevtushenko@yandex.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sergeybashirov@gmail.com \
--cc=trondmy@kernel.org \
/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
all inboxes | Powered by JetHome®