Re: [PATCH 1/1] fs/squashfs/file_direct.c: replace count*size kmalloc by kcalloc

From: Joe Perches
Date: Mon Jun 16 2014 - 14:37:54 EST


On Mon, 2014-06-16 at 20:12 +0200, Fabian Frederick wrote:
> kcalloc manages count*sizeof overflow.

so does kmalloc_array

> diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c
[]
> - page = kmalloc(sizeof(void *) * pages, GFP_KERNEL);
> + page = kcalloc(pages, sizeof(void *), GFP_KERNEL);


kmalloc(a * sizeof(b), GFP) -> kmalloc_array(a, sizeof(b), GFP)
kzalloc(a * sizeof(b), GFP) -> kcalloc(a, sizeof(b), GFP)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/