summaryrefslogtreecommitdiff
path: root/fs/splice.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 5fb07c01936f..cad3779fa35c 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -275,9 +275,8 @@ int splice_grow_spd(const struct pipe_inode_info *pipe, struct splice_pipe_desc
if (max_usage <= PIPE_DEF_BUFFERS)
return 0;
- spd->pages = kmalloc_array(max_usage, sizeof(struct page *), GFP_KERNEL);
- spd->partial = kmalloc_array(max_usage, sizeof(struct partial_page),
- GFP_KERNEL);
+ spd->pages = kmalloc_objs(struct page *, max_usage, GFP_KERNEL);
+ spd->partial = kmalloc_objs(struct partial_page, max_usage, GFP_KERNEL);
if (spd->pages && spd->partial)
return 0;
@@ -676,7 +675,7 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
if (!out->f_op->write_iter)
return -EINVAL;
- array = kcalloc(nbufs, sizeof(struct bio_vec), GFP_KERNEL);
+ array = kzalloc_objs(struct bio_vec, nbufs, GFP_KERNEL);
if (unlikely(!array))
return -ENOMEM;
@@ -697,8 +696,7 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
if (unlikely(nbufs < pipe->max_usage)) {
kfree(array);
nbufs = pipe->max_usage;
- array = kcalloc(nbufs, sizeof(struct bio_vec),
- GFP_KERNEL);
+ array = kzalloc_objs(struct bio_vec, nbufs, GFP_KERNEL);
if (!array) {
ret = -ENOMEM;
break;