From: Ganesh Mahendran Date: Sat, 13 Dec 2014 00:57:10 +0000 (-0800) Subject: mm/zsmalloc: allocate exactly size of struct zs_pool X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=181366561ac1e1a7bc3b91dbe45e7614a2f758b9;p=openwrt%2Fstaging%2Fblogic.git mm/zsmalloc: allocate exactly size of struct zs_pool In zs_create_pool(), we allocate memory more then sizeof(struct zs_pool) ovhd_size = roundup(sizeof(*pool), PAGE_SIZE); This patch allocate memory of exactly needed size. Signed-off-by: Ganesh Mahendran Acked-by: Minchan Kim Cc: Nitin Gupta Cc: Dan Streetman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 2021df5eb891..4d0a063145ec 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -979,12 +979,11 @@ static bool can_merge(struct size_class *prev, int size, int pages_per_zspage) */ struct zs_pool *zs_create_pool(gfp_t flags) { - int i, ovhd_size; + int i; struct zs_pool *pool; struct size_class *prev_class = NULL; - ovhd_size = roundup(sizeof(*pool), PAGE_SIZE); - pool = kzalloc(ovhd_size, GFP_KERNEL); + pool = kzalloc(sizeof(*pool), GFP_KERNEL); if (!pool) return NULL;