Skip to content

Commit 9d7ca61

Browse files
olofjtorvalds
authored andcommitted
lib/test_ubsan.c: VLA no longer used in kernel
Since we now build with -Wvla, any use of VLA throws a warning. Including this test, so... maybe we should just remove the test? lib/test_ubsan.c: In function 'test_ubsan_vla_bound_not_positive': lib/test_ubsan.c:48:2: warning: ISO C90 forbids variable length array 'buf' [-Wvla] For the out-of-bounds test, switch to non-VLA setup. lib/test_ubsan.c: In function 'test_ubsan_out_of_bounds': lib/test_ubsan.c:64:2: warning: ISO C90 forbids variable length array 'arr' [-Wvla] Link: http://lkml.kernel.org/r/20190113183210.56154-1-olof@lixom.net Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Dmitry Vyukov <dvyukov@google.com> Cc: Colin Ian King <colin.king@canonical.com> Cc: Jinbum Park <jinb.park7@gmail.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent cdc94a3 commit 9d7ca61

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

‎lib/test_ubsan.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ static void test_ubsan_divrem_overflow(void)
4242
val /= val2;
4343
}
4444

45-
static void test_ubsan_vla_bound_not_positive(void)
46-
{
47-
volatile int size = -1;
48-
char buf[size];
49-
50-
(void)buf;
51-
}
52-
5345
static void test_ubsan_shift_out_of_bounds(void)
5446
{
5547
volatile int val = -1;
@@ -61,7 +53,7 @@ static void test_ubsan_shift_out_of_bounds(void)
6153
static void test_ubsan_out_of_bounds(void)
6254
{
6355
volatile int i = 4, j = 5;
64-
volatile int arr[i];
56+
volatile int arr[4];
6557

6658
arr[j] = i;
6759
}
@@ -113,7 +105,6 @@ static const test_ubsan_fp test_ubsan_array[] = {
113105
test_ubsan_mul_overflow,
114106
test_ubsan_negate_overflow,
115107
test_ubsan_divrem_overflow,
116-
test_ubsan_vla_bound_not_positive,
117108
test_ubsan_shift_out_of_bounds,
118109
test_ubsan_out_of_bounds,
119110
test_ubsan_load_invalid_value,

0 commit comments

Comments
 (0)