From: Dan Carpenter <dan.carpenter@linaro.org>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Filipe Manana <fdmanana@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [bug report] btrfs: abort transaction in the process_one_buffer() log tree walk callback
Date: Fri, 15 Aug 2025 12:13:13 +0300 [thread overview]
Message-ID: <aJ76KSPQYnatNCAd@stanley.mountain> (raw)
In-Reply-To: <CAL3q7H60EKQbXUm_cfEY+bsv+SpnYV0uLuVSGNKkgMnHKCkiGg@mail.gmail.com>
On Fri, Aug 15, 2025 at 09:28:34AM +0100, Filipe Manana wrote:
> On Fri, Aug 15, 2025 at 7:50 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > Hello Filipe Manana,
> >
> > This is a semi-automatic email about new static checker warnings.
> >
> > Commit f6f79221b128 ("btrfs: abort transaction in the
> > process_one_buffer() log tree walk callback") from Jul 16, 2025,
> > leads to the following Smatch complaint:
> >
> > fs/btrfs/tree-log.c:377 process_one_buffer() warn: variable dereferenced before check 'trans' (see line 375)
> > fs/btrfs/tree-log.c:388 process_one_buffer() warn: variable dereferenced before check 'trans' (see line 375)
> >
> > fs/btrfs/tree-log.c
> > 374 if (wc->pin) {
> > 375 ret = btrfs_pin_extent_for_log_replay(trans, eb);
> > ^^^^^
> > The patch adds a dereference
>
> False alarm. This already happened before that patch, we didn't check
> if wc->trans was NULL before calling
> btrfs_pin_extent_for_log_replay(), and that's fine because if wc->pin
> is true then trans is not NULL.
>
To be honest, the deleting the NULL check is the most common way to fix
a "pointless NULL check after a dereference" warning...
regards,
dan carpenter
next prev parent reply other threads:[~2025-08-15 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 6:49 [bug report] btrfs: abort transaction in the process_one_buffer() log tree walk callback Dan Carpenter
2025-08-15 8:28 ` Filipe Manana
2025-08-15 9:13 ` Dan Carpenter [this message]
2025-08-15 11:28 ` Filipe Manana
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=aJ76KSPQYnatNCAd@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=fdmanana@kernel.org \
--cc=fdmanana@suse.com \
--cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.