diff options
author | Michael Davidson <md@google.com> | 2017-04-14 23:15:09 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-18 18:03:42 +0200 |
commit | 9e18308a5dcc2250a271e598dfe0d917b5522475 (patch) | |
tree | 277faf0661876a128d24e7961d19fcc7649b086d /drivers/misc | |
parent | Merge tag 'extcon-next-for-4.12' of git://git.kernel.org/pub/scm/linux/kernel... (diff) | |
download | linux-9e18308a5dcc2250a271e598dfe0d917b5522475.tar.xz linux-9e18308a5dcc2250a271e598dfe0d917b5522475.zip |
misc: lkdtm: Add volatile to intentional NULL pointer reference
Add a volatile qualifier where a NULL pointer is deliberately
dereferenced to trigger a panic.
Without the volatile qualifier clang will issue the following warning:
"indirection of non-volatile null pointer will be deleted,
not trap [-Wnull-dereference]" and replace the pointer reference
with a __builtin_trap() (which generates a ud2 instruction on x86_64).
Signed-off-by: Michael Davidson <md@google.com>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/lkdtm_bugs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/misc/lkdtm_bugs.c b/drivers/misc/lkdtm_bugs.c index ed4f4c56c796..d9028ef50fbe 100644 --- a/drivers/misc/lkdtm_bugs.c +++ b/drivers/misc/lkdtm_bugs.c @@ -69,7 +69,7 @@ void lkdtm_WARNING(void) void lkdtm_EXCEPTION(void) { - *((int *) 0) = 0; + *((volatile int *) 0) = 0; } void lkdtm_LOOP(void) |