hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/lib/test_stackinit.c
....@@ -1,4 +1,4 @@
1
-// SPDX-Licenses: GPLv2
1
+// SPDX-License-Identifier: GPL-2.0
22 /*
33 * Test cases for compiler-based stack variable zeroing via future
44 * compiler flags or CONFIG_GCC_PLUGIN_STRUCTLEAK*.
....@@ -67,10 +67,10 @@
6767 #define INIT_STRUCT_none /**/
6868 #define INIT_STRUCT_zero = { }
6969 #define INIT_STRUCT_static_partial = { .two = 0, }
70
-#define INIT_STRUCT_static_all = { .one = arg->one, \
71
- .two = arg->two, \
72
- .three = arg->three, \
73
- .four = arg->four, \
70
+#define INIT_STRUCT_static_all = { .one = 0, \
71
+ .two = 0, \
72
+ .three = 0, \
73
+ .four = 0, \
7474 }
7575 #define INIT_STRUCT_dynamic_partial = { .two = arg->two, }
7676 #define INIT_STRUCT_dynamic_all = { .one = arg->one, \
....@@ -84,8 +84,7 @@
8484 var.one = 0; \
8585 var.two = 0; \
8686 var.three = 0; \
87
- memset(&var.four, 0, \
88
- sizeof(var.four))
87
+ var.four = 0
8988
9089 /*
9190 * @name: unique string name for the test
....@@ -210,18 +209,13 @@
210209 unsigned long four;
211210 };
212211
213
-/* Try to trigger unhandled padding in a structure. */
214
-struct test_aligned {
215
- u32 internal1;
216
- u64 internal2;
217
-} __aligned(64);
218
-
212
+/* Trigger unhandled padding in a structure. */
219213 struct test_big_hole {
220214 u8 one;
221215 u8 two;
222216 u8 three;
223217 /* 61 byte padding hole here. */
224
- struct test_aligned four;
218
+ u8 four __aligned(64);
225219 } __aligned(64);
226220
227221 struct test_trailing_hole {