From: Kris Van Hees Date: Wed, 8 Jul 2015 03:37:14 +0000 (-0400) Subject: dtrace: do not allocate space for trampolines when probec = 0 X-Git-Tag: v4.1.12-92~313^2~3 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=50ccb82d1f49f76dfbfb0f6a3442ff7f65bf73f9;p=users%2Fjedix%2Flinux-maple.git dtrace: do not allocate space for trampolines when probec = 0 When it is known that a module does not contain any SDT probes, do not try to allocate a 0-sized memory block for trampolines. Signed-off-by: Kris Van Hees Acked-by: Nick Alcock Acked-by: Allen Pais --- diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 08c9d2742043..86a4e3246c52 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -14,10 +14,12 @@ #include #include -#include #include #include #include +#ifdef CONFIG_DTRACE +# include +#endif #include "entry.h" @@ -223,18 +225,22 @@ int module_finalize(const Elf_Ehdr *hdr, __asm__ __volatile__("flush %g6"); } -#ifdef CONFIG_DTRACE - me->pdata = module_alloc(me->sdt_probec * SDT_TRAMP_SIZE * - sizeof(asm_instr_t)); -#endif +# ifdef CONFIG_DTRACE + if (me->sdt_probec > 0) + me->pdata = module_alloc(me->sdt_probec * SDT_TRAMP_SIZE * + sizeof(asm_instr_t)); + else + me->pdata = NULL; +# endif return 0; } -#ifdef CONFIG_DTRACE +# ifdef CONFIG_DTRACE void module_arch_cleanup(struct module *me) { - module_memfree(me->pdata); + if (me->pdata) + module_memfree(me->pdata); } #endif #endif /* CONFIG_SPARC64 */