Skip to content

Commit

Permalink
lkdtm: fix false positive warning from -Wmaybe-uninitialized
Browse files Browse the repository at this point in the history
The variable in use here doesn't matter (it's just used to exercise taking
up stack space), but this changes its use to pass its address instead,
to avoid a compiler warning:

drivers/misc/lkdtm_usercopy.c:54:15: warning: 'bad_stack' may be used uninitialized in this function [-Wmaybe-uninitialized]

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Kees Cook committed Aug 1, 2016
1 parent 0e06f5c commit 3001087
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/misc/lkdtm_usercopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static noinline void do_usercopy_stack(bool to_user, bool bad_frame)

/* This is a pointer to outside our current stack frame. */
if (bad_frame) {
bad_stack = do_usercopy_stack_callee((uintptr_t)bad_stack);
bad_stack = do_usercopy_stack_callee((uintptr_t)&bad_stack);
} else {
/* Put start address just inside stack. */
bad_stack = task_stack_page(current) + THREAD_SIZE;
Expand Down

0 comments on commit 3001087

Please sign in to comment.