kasan, sched/headers: Uninline kasan_enable/disable_current()
authorIngo Molnar <mingo@kernel.org>
Fri, 3 Feb 2017 08:57:00 +0000 (09:57 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 2 Mar 2017 07:42:25 +0000 (08:42 +0100)
<linux/kasan.h> is a low level header that is included early
in affected kernel headers. But it includes <linux/sched.h>
which complicates the cleanup of sched.h dependencies.

But kasan.h has almost no need for sched.h: its only use of
scheduler functionality is in two inline functions which are
not used very frequently - so uninline kasan_enable_current()
and kasan_disable_current().

Also add a <linux/sched.h> dependency to a .c file that depended
on kasan.h including it.

This paves the way to remove the <linux/sched.h> include from kasan.h.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/kasan.h
lib/sbitmap.c
mm/kasan/kasan.c

index c908b25bf5a558bf7b07abb050cd5a148ed62780..7793036eac806295a452dba7fb1372ff27367d04 100644 (file)
@@ -30,16 +30,10 @@ static inline void *kasan_mem_to_shadow(const void *addr)
 }
 
 /* Enable reporting bugs after kasan_disable_current() */
-static inline void kasan_enable_current(void)
-{
-       current->kasan_depth++;
-}
+extern void kasan_enable_current(void);
 
 /* Disable reporting bugs for current task */
-static inline void kasan_disable_current(void)
-{
-       current->kasan_depth--;
-}
+extern void kasan_disable_current(void);
 
 void kasan_unpoison_shadow(const void *address, size_t size);
 
index 55e11c4b2f3b8e65ca118fe107ae931b877f187f..60e800e0b5a0d986ec0e2664dd9e4185aa50328a 100644 (file)
@@ -15,6 +15,7 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#include <linux/sched.h>
 #include <linux/random.h>
 #include <linux/sbitmap.h>
 #include <linux/seq_file.h>
index 25f0e6521f36c66e349804355aac536662e11257..d99312ed7c22924f5408c86f79c9a0bea0655ed4 100644 (file)
 #include "kasan.h"
 #include "../slab.h"
 
+void kasan_enable_current(void)
+{
+       current->kasan_depth++;
+}
+
+void kasan_disable_current(void)
+{
+       current->kasan_depth--;
+}
+
 /*
  * Poisons the shadow memory for 'size' bytes starting from 'addr'.
  * Memory addresses should be aligned to KASAN_SHADOW_SCALE_SIZE.