From: Al Viro <viro@zeniv.linux.org.uk>
To: Joey Pabalinas <joeypabalinas@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs: dlm: Remove impossible to hit if statement
Date: Sun, 5 Nov 2023 23:57:43 +0000 [thread overview]
Message-ID: <20231105235743.GS1957730@ZenIV> (raw)
In-Reply-To: <20231105231125.GR1957730@ZenIV>
On Sun, Nov 05, 2023 at 11:11:25PM +0000, Al Viro wrote:
> Sure, if you hit even a single iteration of that loop, you will
> have memb guaranteed to be non-NULL. Therefore, to complete the
> proof you only need to consider what happens if there is not
> a single iteration. Which is to say, what happens if the list
> is empty. Well, either memb is uninitialized, or there is an
> intialization somewhere upstream. Declaration is not far before
> that loop, and it is
> struct dlm_member *memb = NULL;
> Er... So for that change to be correct you need to show that
> the list (ls->ls_nodes) can not be empty here. Unfortunately,
> it looks like it very much can be empty, seeing that this
> is apparently the only place where elements are added to
> the list in question. So on the very first call it will
> hit your "impossible to hit" case. Which leads to...
>
> * the patch had apparently never been tested.
Looking at the uses of ->ls_nodes, I wonder if xarray would be
a better fit here. Might be interesting to investigate...
prev parent reply other threads:[~2023-11-05 23:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 22:21 [PATCH] fs: dlm: Remove impossible to hit if statement Joey Pabalinas
2023-11-05 23:11 ` Al Viro
2023-11-05 23:57 ` Al Viro [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=20231105235743.GS1957730@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=joeypabalinas@gmail.com \
--cc=linux-kernel@vger.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