btrfs: send: Proactively round up to kmalloc bucket size
authorKees Cook <keescook@chromium.org>
Fri, 23 Sep 2022 20:28:13 +0000 (13:28 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 1 Nov 2022 17:04:52 +0000 (10:04 -0700)
commit905889bc6c842d18f369bf2834cf7219f32709ae
tree2ea427965285e54d4758fafa0b82896d19f63d40
parentcd536db050993f7c220a6cfb01de5356032b6f8e
btrfs: send: Proactively round up to kmalloc bucket size

Instead of discovering the kmalloc bucket size _after_ allocation, round
up proactively so the allocation is explicitly made for the full size,
allowing the compiler to correctly reason about the resulting size of
the buffer through the existing __alloc_size() hint.

Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org
Acked-by: David Sterba <dsterba@suse.com>
Link: https://lore.kernel.org/lkml/20220922133014.GI32411@suse.cz
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220923202822.2667581-8-keescook@chromium.org
fs/btrfs/send.c