kmemleak: Simplify the kmemleak_scan_area() function prototype
Subsystems (2)
Catalin Marinas
maintainerPATCH 1/1 kmemleak: Simplify the kmemleak_scan_area() function prototype
This function was taking non-necessary arguments which can be determined by kmemleak. The patch also modifies the calling sites.
Signed-off-by Catalin Marinas <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Rusty Russell <[email protected]>
---
That's a pretty straight-forward function prototype change which I posted last week but forgot to add the relevant "Cc:" as it touches files other than mm/kmemleak.c.
include/linux/kmemleak.h | 6 ++---- kernel/module.c | 7 ++----- mm/kmemleak.c | 49 ++++++++++++++++++++-------------------------- mm/slab.c | 4 ++-- 4 files changed, 27 insertions(+), 39 deletions(-)
include/linux/kmemleak.h +2 -4
@@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset, size_t size) __ref;extern void kmemleak_not_leak (const void *ptr)__ref ;extern void kmemleak_ignore (const void *ptr)__ref ; -extern void kmemleak_scan_area (const void *ptr,unsigned long offset, -size_t length,gfp_t gfp)__ref ; +extern void kmemleak_scan_area (const void *ptr,size_t size,gfp_t gfp)__ref ;extern void kmemleak_no_scan (const void *ptr)__ref ; static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
@@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr)static inline void kmemleak_ignore (const void *ptr) { } -static inline void kmemleak_scan_area (const void *ptr,unsigned long offset, -size_t length,gfp_t gfp) +static inline void kmemleak_scan_area (const void *ptr,size_t size,gfp_t gfp) { }static inline void kmemleak_erase (void **ptr)
kernel/module.c +2 -5
@@ -2043,9 +2043,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr,unsigned int i;/* only scan the sections containing data */ -kmemleak_scan_area (mod->module_core, (unsigned long )mod - - (unsigned long )mod->module_core, -sizeof (struct module ),GFP_KERNEL ); +kmemleak_scan_area (mod,sizeof (struct module ),GFP_KERNEL );for (i =1 ; i < hdr->e_shnum; i++) {if (!(sechdrs[i].sh_flags &SHF_ALLOC ))
@@ -2054,8 +2052,7 @@ static void kmemleak_load_module(struct module *mod, Elf_Ehdr *hdr, && strncmp(secstrings + sechdrs[i].sh_name, ".bss", 4) != 0) continue; -kmemleak_scan_area (mod->module_core, sechdrs[i].sh_addr - - (unsigned long )mod->module_core, +kmemleak_scan_area ((void *)sechdrs[i].sh_addr, sechdrs[i].sh_size,GFP_KERNEL ); } }
mm/kmemleak.c +21 -28
155 lines not on this page · raw message
mm/slab.c +2 -2
@@ -2584,8 +2584,8 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp,* kmemleak does not treat the ->s_mem pointer as a reference * to the object. Otherwise we will not report the leak. */ -kmemleak_scan_area (slabp, offsetof(struct slab , list), -sizeof (struct list_head ), local_flags); +kmemleak_scan_area (&slabp->list,sizeof (struct list_head ), + local_flags);if (!slabp)return NULL ; }else {