Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457283

[PATCH 1/3] lkdtm: fix false positive warning from -Wmaybe-uninitialized

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH 1/3] lkdtm: fix false positive warning from -Wmaybe-uninitialized
Date 2016-08-05 23:30 +0200
Message-ID <s2UQO-4y0-5@gated-at.bofh.it> (permalink)
References <s2UQO-4y0-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/misc/lkdtm_usercopy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/lkdtm_usercopy.c b/drivers/misc/lkdtm_usercopy.c
index 5a3fd76eec27..5525a204db93 100644
--- a/drivers/misc/lkdtm_usercopy.c
+++ b/drivers/misc/lkdtm_usercopy.c
@@ -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;
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] lkdtm: fixes for v4.8-rc1 Kees Cook <keescook@chromium.org> - 2016-08-05 23:30 +0200
  [PATCH 1/3] lkdtm: fix false positive warning from -Wmaybe-uninitialized Kees Cook <keescook@chromium.org> - 2016-08-05 23:30 +0200
  [PATCH 2/3] lkdtm: Fix targets for objcopy usage Kees Cook <keescook@chromium.org> - 2016-08-05 23:30 +0200
  [PATCH 3/3] lkdtm: Mark lkdtm_rodata_do_nothing() notrace Kees Cook <keescook@chromium.org> - 2016-08-05 23:30 +0200

csiph-web