summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/misc/lkdtm.h5
-rw-r--r--drivers/misc/lkdtm_bugs.c6
-rw-r--r--drivers/misc/lkdtm_core.c6
-rw-r--r--drivers/misc/lkdtm_heap.c6
-rw-r--r--drivers/misc/lkdtm_perms.c6
-rw-r--r--drivers/misc/lkdtm_rodata.c2
-rw-r--r--drivers/misc/lkdtm_usercopy.c4
7 files changed, 10 insertions, 25 deletions
diff --git a/drivers/misc/lkdtm.h b/drivers/misc/lkdtm.h
index d70a41741bb3..fdf954c2107f 100644
--- a/drivers/misc/lkdtm.h
+++ b/drivers/misc/lkdtm.h
@@ -1,6 +1,10 @@
#ifndef __LKDTM_H
#define __LKDTM_H
+#define pr_fmt(fmt) "lkdtm: " fmt
+
+#include <linux/kernel.h>
+
/* lkdtm_bugs.c */
void __init lkdtm_bugs_init(int *recur_param);
void lkdtm_PANIC(void);
@@ -53,5 +57,4 @@ void lkdtm_USERCOPY_STACK_FRAME_FROM(void);
void lkdtm_USERCOPY_STACK_BEYOND(void);
void lkdtm_USERCOPY_KERNEL(void);
-
#endif
diff --git a/drivers/misc/lkdtm_bugs.c b/drivers/misc/lkdtm_bugs.c
index e87071f9c003..182ae1894b32 100644
--- a/drivers/misc/lkdtm_bugs.c
+++ b/drivers/misc/lkdtm_bugs.c
@@ -4,12 +4,8 @@
* lockups) along with other things that don't fit well into existing LKDTM
* test source files.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-
#include "lkdtm.h"
+#include <linux/sched.h>
/*
* Make sure our attempts to over run the kernel stack doesn't trigger
diff --git a/drivers/misc/lkdtm_core.c b/drivers/misc/lkdtm_core.c
index 717aad6d374b..f9154b8d67f6 100644
--- a/drivers/misc/lkdtm_core.c
+++ b/drivers/misc/lkdtm_core.c
@@ -30,9 +30,7 @@
*
* See Documentation/fault-injection/provoke-crashes.txt for instructions
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
+#include "lkdtm.h"
#include <linux/fs.h>
#include <linux/module.h>
#include <linux/buffer_head.h>
@@ -49,8 +47,6 @@
#include <linux/ide.h>
#endif
-#include "lkdtm.h"
-
#define DEFAULT_COUNT 10
static int lkdtm_debugfs_open(struct inode *inode, struct file *file);
diff --git a/drivers/misc/lkdtm_heap.c b/drivers/misc/lkdtm_heap.c
index 12f50e8dcbfe..0f1581664c1c 100644
--- a/drivers/misc/lkdtm_heap.c
+++ b/drivers/misc/lkdtm_heap.c
@@ -2,12 +2,8 @@
* This is for all the tests relating directly to heap memory, including
* page allocation and slab allocations.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
-#include <linux/slab.h>
-
#include "lkdtm.h"
+#include <linux/slab.h>
/*
* This tries to stay within the next largest power-of-2 kmalloc cache
diff --git a/drivers/misc/lkdtm_perms.c b/drivers/misc/lkdtm_perms.c
index 8201006502e2..45f1c0f96612 100644
--- a/drivers/misc/lkdtm_perms.c
+++ b/drivers/misc/lkdtm_perms.c
@@ -3,17 +3,13 @@
* permissions: non-executable regions, non-writable regions, and
* even non-readable regions.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
+#include "lkdtm.h"
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <asm/cacheflush.h>
-#include "lkdtm.h"
-
/* Whether or not to fill the target memory area with do_nothing(). */
#define CODE_WRITE true
#define CODE_AS_IS false
diff --git a/drivers/misc/lkdtm_rodata.c b/drivers/misc/lkdtm_rodata.c
index 4d0d851f02b9..166b1db3969f 100644
--- a/drivers/misc/lkdtm_rodata.c
+++ b/drivers/misc/lkdtm_rodata.c
@@ -2,7 +2,7 @@
* This includes functions that are meant to live entirely in .rodata
* (via objcopy tricks), to validate the non-executability of .rodata.
*/
-#include <linux/kernel.h>
+#include "lkdtm.h"
void lkdtm_rodata_do_nothing(void)
{
diff --git a/drivers/misc/lkdtm_usercopy.c b/drivers/misc/lkdtm_usercopy.c
index 9c748e819a35..5a3fd76eec27 100644
--- a/drivers/misc/lkdtm_usercopy.c
+++ b/drivers/misc/lkdtm_usercopy.c
@@ -2,9 +2,7 @@
* This is for all the tests related to copy_to_user() and copy_from_user()
* hardening.
*/
-#define pr_fmt(fmt) "lkdtm: " fmt
-
-#include <linux/kernel.h>
+#include "lkdtm.h"
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>