From: Al Viro Date: Wed, 23 Apr 2014 14:13:03 +0000 (-0400) Subject: nick kvfree() from apparmor/lib X-Git-Tag: next-20140428~60^2~70 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3c91dc1ce40f973bbceded3d8ce96bda7c4d480c;p=karo-tx-linux.git nick kvfree() from apparmor/lib too many open-coded instances Signed-off-by: Al Viro --- diff --git a/include/linux/mm.h b/include/linux/mm.h index bf9811e1321a..a784964fa418 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -370,6 +370,17 @@ static inline int is_vmalloc_or_module_addr(const void *x) } #endif +static inline void kvfree(const void *x) +{ + /* include order mess... */ + extern void kfree(const void *); + extern void vfree(const void *); + if (is_vmalloc_addr(x)) + vfree(x); + else + kfree(x); +} + static inline void compound_lock(struct page *page) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE diff --git a/security/apparmor/include/apparmor.h b/security/apparmor/include/apparmor.h index 8fb1488a3cd4..97130f88838b 100644 --- a/security/apparmor/include/apparmor.h +++ b/security/apparmor/include/apparmor.h @@ -66,7 +66,6 @@ extern int apparmor_initialized __initdata; char *aa_split_fqname(char *args, char **ns_name); void aa_info_message(const char *str); void *__aa_kvmalloc(size_t size, gfp_t flags); -void kvfree(void *buffer); static inline void *kvmalloc(size_t size) { diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 69689922c491..c1827e068454 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c @@ -104,17 +104,3 @@ void *__aa_kvmalloc(size_t size, gfp_t flags) } return buffer; } - -/** - * kvfree - free an allocation do by kvmalloc - * @buffer: buffer to free (MAYBE_NULL) - * - * Free a buffer allocated by kvmalloc - */ -void kvfree(void *buffer) -{ - if (is_vmalloc_addr(buffer)) - vfree(buffer); - else - kfree(buffer); -}