Skip to content

Commit b45861e

Browse files
committed
lkdtm/bugs: Switch from 1-element array to flexible array
The testing for ARRAY_BOUNDS just wants an uninstrumented array, and the proper flexible array definition is fine for that. Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Reviewed-by: Bill Wendling <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 7391928 commit b45861e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/misc/lkdtm/bugs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static void lkdtm_OVERFLOW_UNSIGNED(void)
309309
struct array_bounds_flex_array {
310310
int one;
311311
int two;
312-
char data[1];
312+
char data[];
313313
};
314314

315315
struct array_bounds {
@@ -341,7 +341,7 @@ static void lkdtm_ARRAY_BOUNDS(void)
341341
* For the uninstrumented flex array member, also touch 1 byte
342342
* beyond to verify it is correctly uninstrumented.
343343
*/
344-
for (i = 0; i < sizeof(not_checked->data) + 1; i++)
344+
for (i = 0; i < 2; i++)
345345
not_checked->data[i] = 'A';
346346

347347
pr_info("Array access beyond bounds ...\n");

0 commit comments

Comments
 (0)