public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/test_stackinit: move a local outside the switch statement
@ 2020-02-18  9:48 glider
  2020-02-19 17:36 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: glider @ 2020-02-18  9:48 UTC (permalink / raw)
  To: keescook, jannh, ard.biesheuvel; +Cc: linux-kernel, Alexander Potapenko

Right now CONFIG_INIT_STACK_ALL is unable to initialize locals declared
in switch statements, see http://llvm.org/PR44916.
Move the variable declaration outside the switch in lib/test_stackinit.c
to prevent potential test failures until this is sorted out.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Alexander Potapenko <glider@google.com>
---
 lib/test_stackinit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c
index 2d7d257a430e..41e2a6e0cdaa 100644
--- a/lib/test_stackinit.c
+++ b/lib/test_stackinit.c
@@ -282,9 +282,9 @@ DEFINE_TEST(user, struct test_user, STRUCT, none);
  */
 static int noinline __leaf_switch_none(int path, bool fill)
 {
-	switch (path) {
-		uint64_t var;
+	uint64_t var;
 
+	switch (path) {
 	case 1:
 		target_start = &var;
 		target_size = sizeof(var);
-- 
2.25.0.265.gbab2e86ba0-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-19 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18  9:48 [PATCH] lib/test_stackinit: move a local outside the switch statement glider
2020-02-19 17:36 ` Kees Cook
2020-02-19 17:56   ` Alexander Potapenko
2020-02-19 21:58     ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox