diff options
author | Kees Cook <keescook@chromium.org> | 2016-07-15 19:04:39 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2016-07-15 19:14:45 -0400 |
commit | 6d2e91a662256fd88ec0505567a59d21094ed415 (patch) | |
tree | 97c6a4c79a66ffa019f1c648e81fcef687e97fb1 | |
parent | 2b271cb7203dd4dcea991119367df2ed7e66f3c7 (diff) |
lkdtm: silence warnings about function declarations
When building under W=1, the lack of lkdtm.h in lkdtm_usercopy.c and
lkdtm_rodata.c was discovered. This fixes the issue and consolidates
the common header and the pr_fmt macro for simplicity and regularity
across each test source file.
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | drivers/misc/lkdtm.h | 5 | ||||
-rw-r--r-- | drivers/misc/lkdtm_bugs.c | 6 | ||||
-rw-r--r-- | drivers/misc/lkdtm_core.c | 6 | ||||
-rw-r--r-- | drivers/misc/lkdtm_heap.c | 6 | ||||
-rw-r--r-- | drivers/misc/lkdtm_perms.c | 6 | ||||
-rw-r--r-- | drivers/misc/lkdtm_rodata.c | 2 | ||||
-rw-r--r-- | drivers/misc/lkdtm_usercopy.c | 4 |
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 @@ | |||
1 | #ifndef __LKDTM_H | 1 | #ifndef __LKDTM_H |
2 | #define __LKDTM_H | 2 | #define __LKDTM_H |
3 | 3 | ||
4 | #define pr_fmt(fmt) "lkdtm: " fmt | ||
5 | |||
6 | #include <linux/kernel.h> | ||
7 | |||
4 | /* lkdtm_bugs.c */ | 8 | /* lkdtm_bugs.c */ |
5 | void __init lkdtm_bugs_init(int *recur_param); | 9 | void __init lkdtm_bugs_init(int *recur_param); |
6 | void lkdtm_PANIC(void); | 10 | void lkdtm_PANIC(void); |
@@ -53,5 +57,4 @@ void lkdtm_USERCOPY_STACK_FRAME_FROM(void); | |||
53 | void lkdtm_USERCOPY_STACK_BEYOND(void); | 57 | void lkdtm_USERCOPY_STACK_BEYOND(void); |
54 | void lkdtm_USERCOPY_KERNEL(void); | 58 | void lkdtm_USERCOPY_KERNEL(void); |
55 | 59 | ||
56 | |||
57 | #endif | 60 | #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 @@ | |||
4 | * lockups) along with other things that don't fit well into existing LKDTM | 4 | * lockups) along with other things that don't fit well into existing LKDTM |
5 | * test source files. | 5 | * test source files. |
6 | */ | 6 | */ |
7 | #define pr_fmt(fmt) "lkdtm: " fmt | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/sched.h> | ||
11 | |||
12 | #include "lkdtm.h" | 7 | #include "lkdtm.h" |
8 | #include <linux/sched.h> | ||
13 | 9 | ||
14 | /* | 10 | /* |
15 | * Make sure our attempts to over run the kernel stack doesn't trigger | 11 | * 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 @@ | |||
30 | * | 30 | * |
31 | * See Documentation/fault-injection/provoke-crashes.txt for instructions | 31 | * See Documentation/fault-injection/provoke-crashes.txt for instructions |
32 | */ | 32 | */ |
33 | #define pr_fmt(fmt) "lkdtm: " fmt | 33 | #include "lkdtm.h" |
34 | |||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/fs.h> | 34 | #include <linux/fs.h> |
37 | #include <linux/module.h> | 35 | #include <linux/module.h> |
38 | #include <linux/buffer_head.h> | 36 | #include <linux/buffer_head.h> |
@@ -49,8 +47,6 @@ | |||
49 | #include <linux/ide.h> | 47 | #include <linux/ide.h> |
50 | #endif | 48 | #endif |
51 | 49 | ||
52 | #include "lkdtm.h" | ||
53 | |||
54 | #define DEFAULT_COUNT 10 | 50 | #define DEFAULT_COUNT 10 |
55 | 51 | ||
56 | static int lkdtm_debugfs_open(struct inode *inode, struct file *file); | 52 | 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 @@ | |||
2 | * This is for all the tests relating directly to heap memory, including | 2 | * This is for all the tests relating directly to heap memory, including |
3 | * page allocation and slab allocations. | 3 | * page allocation and slab allocations. |
4 | */ | 4 | */ |
5 | #define pr_fmt(fmt) "lkdtm: " fmt | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/slab.h> | ||
9 | |||
10 | #include "lkdtm.h" | 5 | #include "lkdtm.h" |
6 | #include <linux/slab.h> | ||
11 | 7 | ||
12 | /* | 8 | /* |
13 | * This tries to stay within the next largest power-of-2 kmalloc cache | 9 | * 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 @@ | |||
3 | * permissions: non-executable regions, non-writable regions, and | 3 | * permissions: non-executable regions, non-writable regions, and |
4 | * even non-readable regions. | 4 | * even non-readable regions. |
5 | */ | 5 | */ |
6 | #define pr_fmt(fmt) "lkdtm: " fmt | 6 | #include "lkdtm.h" |
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/slab.h> | 7 | #include <linux/slab.h> |
10 | #include <linux/vmalloc.h> | 8 | #include <linux/vmalloc.h> |
11 | #include <linux/mman.h> | 9 | #include <linux/mman.h> |
12 | #include <linux/uaccess.h> | 10 | #include <linux/uaccess.h> |
13 | #include <asm/cacheflush.h> | 11 | #include <asm/cacheflush.h> |
14 | 12 | ||
15 | #include "lkdtm.h" | ||
16 | |||
17 | /* Whether or not to fill the target memory area with do_nothing(). */ | 13 | /* Whether or not to fill the target memory area with do_nothing(). */ |
18 | #define CODE_WRITE true | 14 | #define CODE_WRITE true |
19 | #define CODE_AS_IS false | 15 | #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 @@ | |||
2 | * This includes functions that are meant to live entirely in .rodata | 2 | * This includes functions that are meant to live entirely in .rodata |
3 | * (via objcopy tricks), to validate the non-executability of .rodata. | 3 | * (via objcopy tricks), to validate the non-executability of .rodata. |
4 | */ | 4 | */ |
5 | #include <linux/kernel.h> | 5 | #include "lkdtm.h" |
6 | 6 | ||
7 | void lkdtm_rodata_do_nothing(void) | 7 | void lkdtm_rodata_do_nothing(void) |
8 | { | 8 | { |
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 @@ | |||
2 | * This is for all the tests related to copy_to_user() and copy_from_user() | 2 | * This is for all the tests related to copy_to_user() and copy_from_user() |
3 | * hardening. | 3 | * hardening. |
4 | */ | 4 | */ |
5 | #define pr_fmt(fmt) "lkdtm: " fmt | 5 | #include "lkdtm.h" |
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
9 | #include <linux/vmalloc.h> | 7 | #include <linux/vmalloc.h> |
10 | #include <linux/mman.h> | 8 | #include <linux/mman.h> |