From: David Sterba <dsterba@suse.cz>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: remove unnecessary NULL check for the new inode during rename exchange
Date: Thu, 29 Jul 2021 19:27:43 +0200 [thread overview]
Message-ID: <20210729172743.GA5047@twin.jikos.cz> (raw)
In-Reply-To: <8dd8e8f3020a5bd13ae22a1f21b8328adc1f4636.1627568438.git.fdmanana@suse.com>
On Thu, Jul 29, 2021 at 03:28:34PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> At the very end of btrfs_rename_exchange(), in case an error happened, we
> are checking if 'new_inode' is NULL, but that is not needed since during a
> rename exchange, unlike regular renames, 'new_inode' can never be NULL,
> and if it were, we would have a crash much earlier when we dereference it
> multiple times.
>
> So remove the check because it is not necessary and because it is causing
> static checkers to emit a warning. I probably introduced the check by
> copy-pasting similar code from btrfs_rename(), where 'new_inode' can be
> NULL, in commit 86e8aa0e772cab ("Btrfs: unpin logs if rename exchange
> operation fails").
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Added to misc-next, thanks.
prev parent reply other threads:[~2021-07-29 17:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-29 14:28 [PATCH] btrfs: remove unnecessary NULL check for the new inode during rename exchange fdmanana
2021-07-29 17:27 ` David Sterba [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=20210729172743.GA5047@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--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 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).