mm: move is_kernel_rodata() to asm-generic/sections.h

Export this routine so that we can use it later in devm_kstrdup_const()
and devm_kfree().

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Acked-by: Mike Rapoport <[email protected]>
Acked-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Bartosz Golaszewski 2018-10-14 17:20:08 +02:00 • committed by Greg Kroah-Hartman
commit 59c3f82ad1
2 changed files with 14 additions and 7 deletions

View file

@ -15,17 +15,10 @@
#include <linux/vmalloc.h>
#include <linux/userfaultfd_k.h>
#include <asm/sections.h>
#include <linux/uaccess.h>
#include "internal.h"
static inline int is_kernel_rodata(unsigned long addr)
{
return addr >= (unsigned long)__start_rodata &&
addr < (unsigned long)__end_rodata;
}
/**
* kfree_const - conditionally free memory
* @x: pointer to the memory