Thread (2 messages) 2 messages, 2 authors, 2021-07-29

Re: [PATCH] btrfs: remove unnecessary NULL check for the new inode during rename exchange

From: David Sterba <hidden>
Date: 2021-07-29 17:30:32

On Thu, Jul 29, 2021 at 03:28:34PM +0100, fdmanana@kernel.org wrote:
From: Filipe Manana <redacted>

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 <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Filipe Manana <redacted>
Added to misc-next, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help