From: Filipe Manana Date: Tue, 21 Mar 2023 11:13:39 +0000 (+0000) Subject: btrfs: remove check for NULL block reserve at btrfs_block_rsv_check() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b93fa4acbb57470d48de381ec4aef3f481b32d67;p=linux.git btrfs: remove check for NULL block reserve at btrfs_block_rsv_check() The block reserve passed to btrfs_block_rsv_check() is never NULL, so remove the check. In case it can ever become NULL in the future, then we'll get a pretty obvious and clear NULL pointer dereference crash and stack trace. Reviewed-by: Josef Bacik Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c index 5367a14d44d2a..364a3d11bf888 100644 --- a/fs/btrfs/block-rsv.c +++ b/fs/btrfs/block-rsv.c @@ -232,9 +232,6 @@ int btrfs_block_rsv_check(struct btrfs_block_rsv *block_rsv, int min_percent) u64 num_bytes = 0; int ret = -ENOSPC; - if (!block_rsv) - return 0; - spin_lock(&block_rsv->lock); num_bytes = mult_perc(block_rsv->size, min_percent); if (block_rsv->reserved >= num_bytes)