diff mbox series

lib/test_stackinit: Expand variable size for correct testing

Message ID 20220215165910.1246018-1-keescook@chromium.org (mailing list archive)
State Changes Requested
Headers show
Series lib/test_stackinit: Expand variable size for correct testing | expand

Commit Message

Kees Cook Feb. 15, 2022, 4:59 p.m. UTC
The pre-case switch variable was too small for the test to detect
missing initialization. Expand the variable so the test will start to
(expectedly) fail again.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 lib/test_stackinit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/test_stackinit.c b/lib/test_stackinit.c
index a3c74e6a21ff..70bb4f7dea38 100644
--- a/lib/test_stackinit.c
+++ b/lib/test_stackinit.c
@@ -398,7 +398,7 @@  static int noinline __leaf_switch_none(int path, bool fill)
 		 * This is intentionally unreachable. To silence the
 		 * warning, build with -Wno-switch-unreachable
 		 */
-		uint64_t var;
+		uint64_t var[10];
 
 	case 1:
 		target_start = &var;
@@ -423,8 +423,8 @@  static int noinline __leaf_switch_none(int path, bool fill)
 		memcpy(check_buf, target_start, target_size);
 		break;
 	default:
-		var = 5;
-		return var & forced_mask;
+		var[1] = 5;
+		return var[1] & forced_mask;
 	}
 	return 0;
 }