From: Kevin Hilman Date: Sat, 19 Oct 2013 05:52:46 +0000 (-0700) Subject: devres: restore zeroing behavior of devres_alloc() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6fffcfa7c0fc438d3667b4eb2074d94f69c12c7b;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git devres: restore zeroing behavior of devres_alloc() commit 64c862a8 (devres: add kernel standard devm_k.alloc functions) changed the default behavior of alloc_dr() to no longer zero the allocated memory. However, only the devm.k.alloc() function were modified to pass in __GFP_ZERO which leaves any users of devres_alloc() or __devres_alloc() with potentially wrong assumptions about memory being zero'd upon allocation. To fix, add __GFP_ZERO to devres_alloc() calls to preserve previous behavior of zero'ing memory upon allocation. Signed-off-by: Kevin Hilman Cc: Tejun Heo Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/devres.c b/drivers/base/devres.c index 37e67a26e388..545c4de412c3 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c @@ -111,7 +111,7 @@ void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, { struct devres *dr; - dr = alloc_dr(release, size, gfp); + dr = alloc_dr(release, size, gfp | __GFP_ZERO); if (unlikely(!dr)) return NULL; set_node_dbginfo(&dr->node, name, size); @@ -136,7 +136,7 @@ void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp) { struct devres *dr; - dr = alloc_dr(release, size, gfp); + dr = alloc_dr(release, size, gfp | __GFP_ZERO); if (unlikely(!dr)) return NULL; return dr->data;