diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index b9f05efd9c..9c1f87caca 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -725,7 +726,8 @@ static int sqfs_read_inode_table(unsigned char **inode_table) goto free_itb; } - *inode_table = malloc(metablks_count * SQFS_METADATA_BLOCK_SIZE); + *inode_table = kcalloc(metablks_count, SQFS_METADATA_BLOCK_SIZE, + GFP_KERNEL); if (!*inode_table) { ret = -ENOMEM; printf("Error: failed to allocate squashfs inode_table of size %i, increasing CONFIG_SYS_MALLOC_LEN could help\n",