btrfs: use kvcalloc for allocation in btrfs_ioctl_send()
authorDenis Efremov <efremov@linux.com>
Mon, 21 Sep 2020 17:03:36 +0000 (20:03 +0300)
committerDavid Sterba <dsterba@suse.com>
Wed, 7 Oct 2020 10:13:22 +0000 (12:13 +0200)
commitbae12df966f0e1a9b40a2c46d01a0ad79b2c865c
treeb3646bc6434e34f90442e5eda3849236f8d32e91
parent8eb2fd00153a3a96a19c62ac9c6d48c2efebe5e8
btrfs: use kvcalloc for allocation in btrfs_ioctl_send()

Replace kvzalloc() call with kvcalloc() that also checks the size
internally. There's a standalone overflow check in the function so we
can return invalid parameter combination.  Use array_size() helper to
compute the memory size for clone_sources_tmp.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Denis Efremov <efremov@linux.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c