Commit b45861ed authored by Kees Cook's avatar Kees Cook

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 <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarBill Wendling <morbo@google.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 73919280
...@@ -309,7 +309,7 @@ static void lkdtm_OVERFLOW_UNSIGNED(void) ...@@ -309,7 +309,7 @@ static void lkdtm_OVERFLOW_UNSIGNED(void)
struct array_bounds_flex_array { struct array_bounds_flex_array {
int one; int one;
int two; int two;
char data[1]; char data[];
}; };
struct array_bounds { struct array_bounds {
...@@ -341,7 +341,7 @@ static void lkdtm_ARRAY_BOUNDS(void) ...@@ -341,7 +341,7 @@ static void lkdtm_ARRAY_BOUNDS(void)
* For the uninstrumented flex array member, also touch 1 byte * For the uninstrumented flex array member, also touch 1 byte
* beyond to verify it is correctly uninstrumented. * beyond to verify it is correctly uninstrumented.
*/ */
for (i = 0; i < sizeof(not_checked->data) + 1; i++) for (i = 0; i < 2; i++)
not_checked->data[i] = 'A'; not_checked->data[i] = 'A';
pr_info("Array access beyond bounds ...\n"); pr_info("Array access beyond bounds ...\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment