[patch] UBIFS: use kmalloc_array() in recomp_data_node()
Dan Carpenter
dan.carpenter at oracle.com
Sat Nov 17 10:11:26 EST 2012
Using kmalloc_array() is a cleanup and it includes a check for integer
overflows.
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index afaad07..23c2a20 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -1104,7 +1104,7 @@ static int recomp_data_node(struct ubifs_data_node *dn, int *new_len)
int err, len, compr_type, out_len;
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;
More information about the linux-mtd
mailing list