aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-07-02 23:47:13 +0200
committerRichard Weinberger <richard@nod.at>2018-08-15 00:25:20 +0200
commita3d218280c273f298b0a17902bc2b4aa3f1dae06 (patch)
treefafbd048d6f7c1d50bbe1c686f0ae1751c21373f /fs/ubifs
parentubifs: Check data node size before truncate (diff)
downloadlinux-dev-a3d218280c273f298b0a17902bc2b4aa3f1dae06.tar.xz
linux-dev-a3d218280c273f298b0a17902bc2b4aa3f1dae06.zip
ubifs: Use kmalloc_array()
Since commit 6da2ec56059c ("treewide: kmalloc() -> kmalloc_array()") we use kmalloc_array() for kmalloc() that computes the length with a multiplication. Cc: Kees Cook <keescook@chromium.org> Suggested-by: Kees Cook <keescook@chromium.org> Signed-off-by: Richard Weinberger <richard@nod.at> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/journal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index cef0d76d490a..42ba4ceb81ee 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -1291,7 +1291,7 @@ static int truncate_data_node(const struct ubifs_info *c, const struct inode *in
int err, dlen, compr_type, out_len, old_dlen;
out_len = le32_to_cpu(dn->size);
- buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS);
+ buf = kmalloc_array(out_len, WORST_COMPR_FACTOR, GFP_NOFS);
if (!buf)
return -ENOMEM;