summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorDavid Sterba2016-02-11 15:01:38 +0100
committerDavid Sterba2016-02-11 15:19:39 +0100
commit66722f7c059089ad7f11eaa3e27af2321ab1b0e6 (patch)
tree70341af1959f7826e0305102408daa116e1231dc /fs/btrfs
parentbtrfs: extent same: use GFP_KERNEL for page array allocations (diff)
downloadkernel-qcow2-linux-66722f7c059089ad7f11eaa3e27af2321ab1b0e6.tar.gz
kernel-qcow2-linux-66722f7c059089ad7f11eaa3e27af2321ab1b0e6.tar.xz
kernel-qcow2-linux-66722f7c059089ad7f11eaa3e27af2321ab1b0e6.zip
btrfs: switch to kcalloc in btrfs_cmp_data_prepare
Kcalloc is functionally equivalent and does overflow checks. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 55440a742594..11dae2a30eb5 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2925,8 +2925,8 @@ static int btrfs_cmp_data_prepare(struct inode *src, u64 loff,
* of the array is bounded by len, which is in turn bounded by
* BTRFS_MAX_DEDUPE_LEN.
*/
- src_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
- dst_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
+ src_pgarr = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL);
+ dst_pgarr = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL);
if (!src_pgarr || !dst_pgarr) {
kfree(src_pgarr);
kfree(dst_pgarr);