nick kvfree() from apparmor
too many places open-code it Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
50c6e282bd
commit
39f1f78d53
@ -370,6 +370,8 @@ static inline int is_vmalloc_or_module_addr(const void *x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void kvfree(const void *addr);
|
||||||
|
|
||||||
static inline void compound_lock(struct page *page)
|
static inline void compound_lock(struct page *page)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||||
|
10
mm/util.c
10
mm/util.c
@ -10,6 +10,7 @@
|
|||||||
#include <linux/swapops.h>
|
#include <linux/swapops.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/hugetlb.h>
|
#include <linux/hugetlb.h>
|
||||||
|
#include <linux/vmalloc.h>
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
|
||||||
@ -387,6 +388,15 @@ unsigned long vm_mmap(struct file *file, unsigned long addr,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(vm_mmap);
|
EXPORT_SYMBOL(vm_mmap);
|
||||||
|
|
||||||
|
void kvfree(const void *addr)
|
||||||
|
{
|
||||||
|
if (is_vmalloc_addr(addr))
|
||||||
|
vfree(addr);
|
||||||
|
else
|
||||||
|
kfree(addr);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(kvfree);
|
||||||
|
|
||||||
struct address_space *page_mapping(struct page *page)
|
struct address_space *page_mapping(struct page *page)
|
||||||
{
|
{
|
||||||
struct address_space *mapping = page->mapping;
|
struct address_space *mapping = page->mapping;
|
||||||
|
@ -66,7 +66,6 @@ extern int apparmor_initialized __initdata;
|
|||||||
char *aa_split_fqname(char *args, char **ns_name);
|
char *aa_split_fqname(char *args, char **ns_name);
|
||||||
void aa_info_message(const char *str);
|
void aa_info_message(const char *str);
|
||||||
void *__aa_kvmalloc(size_t size, gfp_t flags);
|
void *__aa_kvmalloc(size_t size, gfp_t flags);
|
||||||
void kvfree(void *buffer);
|
|
||||||
|
|
||||||
static inline void *kvmalloc(size_t size)
|
static inline void *kvmalloc(size_t size)
|
||||||
{
|
{
|
||||||
|
@ -104,17 +104,3 @@ void *__aa_kvmalloc(size_t size, gfp_t flags)
|
|||||||
}
|
}
|
||||||
return buffer;
|
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);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user