]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: add ASSERTs on prealloc in qgroup functions
authorMiquel Sabaté Solà <mssola@mssola.com>
Fri, 24 Oct 2025 10:21:43 +0000 (12:21 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Nov 2025 21:34:51 +0000 (22:34 +0100)
commit252877a8701530fde861a4f27710c1e718e97caa
tree8557fad86b7d4a9c746be6e937af39df9a841c64
parent7ab5d01d58a766807e137cbe8c90cb2e591e2f7d
btrfs: add ASSERTs on prealloc in qgroup functions

The prealloc variable in these functions is always initialized to
NULL. Whenever we allocate memory for it, if it fails then NULL is
preserved, otherwise we delegate the ownership of the pointer to
add_qgroup_rb() and set it right after to NULL.

Since in any case the pointer ends up being NULL at the end of its
usage, we can safely remove calls to kfree() for it, while adding an
ASSERT as an extra check.

Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/qgroup.c