| From: Stephen Rothwell <sfr@canb.auug.org.au> |
| Subject: similar to "kasan: test: fix compatibility with FORTIFY_SOURCE" |
| |
| Link: https://lkml.kernel.org/r/20220128144801.73f5ced0@canb.auug.org.au |
| Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> |
| Cc: Andrey Konovalov <andreyknvl@gmail.com> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| lib/test_kasan.c | 2 ++ |
| 1 file changed, 2 insertions(+) |
| |
| --- a/lib/test_kasan.c~kasan-improve-vmalloc-tests-fix |
| +++ a/lib/test_kasan.c |
| @@ -1104,6 +1104,8 @@ static void vmalloc_oob(struct kunit *te |
| v_ptr = vmalloc(size); |
| KUNIT_ASSERT_NOT_ERR_OR_NULL(test, v_ptr); |
| |
| + OPTIMIZER_HIDE_VAR(v_ptr); |
| + |
| /* |
| * We have to be careful not to hit the guard page in vmalloc tests. |
| * The MMU will catch that and crash us. |
| _ |