aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/lkdtm/bugs.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2023-05-22 21:28:46 +0000
committerKees Cook <[email protected]>2023-05-30 23:42:00 +0000
commitb45861ed66ded8b31c718ed096c993dfba2b07df (patch)
treed57e8782d64ea392db17e1f29ef459ab4442079d /drivers/misc/lkdtm/bugs.c
parentbefs: Replace all non-returning strlcpy with strscpy (diff)
downloadkernel-b45861ed66ded8b31c718ed096c993dfba2b07df.tar.gz
kernel-b45861ed66ded8b31c718ed096c993dfba2b07df.zip
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]>
Diffstat (limited to 'drivers/misc/lkdtm/bugs.c')
-rw-r--r--drivers/misc/lkdtm/bugs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c
index 48821f4c2b21..d359e38dd1a6 100644
--- a/drivers/misc/lkdtm/bugs.c
+++ b/drivers/misc/lkdtm/bugs.c
@@ -309,7 +309,7 @@ static void lkdtm_OVERFLOW_UNSIGNED(void)
struct array_bounds_flex_array {
int one;
int two;
- char data[1];
+ char data[];
};
struct array_bounds {
@@ -341,7 +341,7 @@ static void lkdtm_ARRAY_BOUNDS(void)
* For the uninstrumented flex array member, also touch 1 byte
* 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';
pr_info("Array access beyond bounds ...\n");