mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-11-01 02:21:16 +00:00
UPSTREAM: mm/zsmalloc: allocate exactly size of struct zs_pool
(cherry-pick from commit 181366561ac1e1a7bc3b91dbe45e7614a2f758b9) 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. Bug: 25951511 Change-Id: Iae1216f7ab304164ea7d687e0037574d6738c94e Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Nitin Gupta <ngupta@vflare.org> Cc: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0349162dc3
commit
caeae3dbac
1 changed files with 2 additions and 3 deletions
|
@ -980,12 +980,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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue