From 472b76ba4279e822aca4ec28987b6b811e999be2 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 3 Jul 2008 17:43:54 -0400 Subject: [PATCH] Move the definition of ksplice_kcalloc above its use. Signed-off-by: Anders Kaseorg --- kmodsrc/ksplice.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/kmodsrc/ksplice.c b/kmodsrc/ksplice.c index 8dcf4ee..8508eb5 100644 --- a/kmodsrc/ksplice.c +++ b/kmodsrc/ksplice.c @@ -39,7 +39,16 @@ /* Old kernels do not have kcalloc */ #define kcalloc ksplice_kcalloc static inline void *ksplice_kcalloc(size_t n, size_t size, - typeof(GFP_KERNEL) flags); + typeof(GFP_KERNEL) flags) +{ + char *mem; + if (n != 0 && size > ULONG_MAX / n) + return NULL; + mem = kmalloc(n * size, flags); + if (mem) + memset(mem, 0, n * size); + return mem; +} /* Old kernels use semaphore instead of mutex 97d1f15b7ef52c1e9c28dc48b454024bb53a5fd2 was after 2.6.16 */ @@ -991,19 +1000,6 @@ int brute_search_all(struct module_pack *pack, struct ksplice_size *s) return ret; } -/* old kernels do not have kcalloc */ -static inline void *ksplice_kcalloc(size_t n, size_t size, - typeof(GFP_KERNEL) flags) -{ - char *mem; - if (n != 0 && size > ULONG_MAX / n) - return NULL; - mem = kmalloc(n * size, flags); - if (mem) - memset(mem, 0, n * size); - return mem; -} - #ifdef CONFIG_KALLSYMS /* Modified version of Linux's kallsyms_lookup_name */ int kernel_lookup(const char *name_wlabel, struct list_head *vals) -- 2.11.4.GIT