Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: refactor allocation size calculation in alloc_btrfs_io_context()

Use struct_size() to replace the open-coded calculation, remove the
comment as use of the helper is self explanatory.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Mehdi Ben Hadj Khelifa and committed by
David Sterba
2346b966 aebe2bb0

+1 -6
+1 -6
fs/btrfs/volumes.c
··· 6076 6076 { 6077 6077 struct btrfs_io_context *bioc; 6078 6078 6079 - bioc = kzalloc( 6080 - /* The size of btrfs_io_context */ 6081 - sizeof(struct btrfs_io_context) + 6082 - /* Plus the variable array for the stripes */ 6083 - sizeof(struct btrfs_io_stripe) * (total_stripes), 6084 - GFP_NOFS); 6079 + bioc = kzalloc(struct_size(bioc, stripes, total_stripes), GFP_NOFS); 6085 6080 6086 6081 if (!bioc) 6087 6082 return NULL;