public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [patch] UBIFS: use kmalloc_array() in recomp_data_node()
@ 2012-11-17 15:11 Dan Carpenter
  2012-11-22 10:31 ` Artem Bityutskiy
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2012-11-17 15:11 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: kernel-janitors, linux-mtd, Adrian Hunter

Using kmalloc_array() is a cleanup and it includes a check for integer
overflows.

Signed-off-by: Dan Carpenter <dan.carpenter@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;
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-22 16:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-17 15:11 [patch] UBIFS: use kmalloc_array() in recomp_data_node() Dan Carpenter
2012-11-22 10:31 ` Artem Bityutskiy
2012-11-22 11:14   ` Dan Carpenter
2012-11-22 11:24     ` Artem Bityutskiy
2012-11-22 12:33       ` Dan Carpenter
2012-11-22 14:48         ` Artem Bityutskiy
2012-11-22 16:41           ` Dan Carpenter
2012-11-22 11:26     ` Artem Bityutskiy
2012-11-22 11:29       ` Artem Bityutskiy
2012-11-22 12:09         ` Dan Carpenter
2012-11-22 11:50       ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox