Sync the changes to e2fsck/revoke.c from commit
6da2ec56059c
("treewide: kmalloc() -> kmalloc_array()"), and add the emulation of
kmalloc_array() to e2fsck/jfs_user.h
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
#define kmalloc(len, flags) malloc(len)
#define kfree(p) free(p)
+static inline void *kmalloc_array(unsigned n, unsigned size, int flags)
+{
+ if (n && (~0U)/n < size)
+ return NULL;
+ return malloc(n * size);
+}
+
#define cond_resched() do { } while (0)
#define __init
table->hash_size = hash_size;
table->hash_shift = shift;
table->hash_table =
- kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL);
+ kmalloc_array(hash_size, sizeof(struct list_head), GFP_KERNEL);
if (!table->hash_table) {
kmem_cache_free(jbd2_revoke_table_cache, table);
table = NULL;