From 93d2efd8319fbe8b2ca8302812c08a385f36d4a7 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 15 Oct 2024 16:53:38 -0700 Subject: [PATCH] mm-kasan-kmsan-copy_from-to_kernel_nofault-fix fix comment layout, per checkpatch Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: Dmitry Vyukov Cc: Marco Elver Cc: Sabyrzhan Tasbolatov Cc: Vincenzo Frascino Signed-off-by: Andrew Morton --- mm/kasan/kasan_test_c.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mm/kasan/kasan_test_c.c b/mm/kasan/kasan_test_c.c index e52c6ab803e8..fe132ce3c2b3 100644 --- a/mm/kasan/kasan_test_c.c +++ b/mm/kasan/kasan_test_c.c @@ -1934,8 +1934,10 @@ static void copy_to_kernel_nofault_oob(struct kunit *test) char buf[128]; size_t size = sizeof(buf); - /* This test currently fails with the HW_TAGS mode. - * The reason is unknown and needs to be investigated. */ + /* + * This test currently fails with the HW_TAGS mode. The reason is + * unknown and needs to be investigated. + */ KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_HW_TAGS); ptr = kmalloc(size - KASAN_GRANULE_SIZE, GFP_KERNEL); @@ -1943,16 +1945,16 @@ static void copy_to_kernel_nofault_oob(struct kunit *test) OPTIMIZER_HIDE_VAR(ptr); /* - * We test copy_to_kernel_nofault() to detect corrupted memory that is - * being written into the kernel. In contrast, copy_from_kernel_nofault() - * is primarily used in kernel helper functions where the source address - * might be random or uninitialized. Applying KASAN instrumentation to - * copy_from_kernel_nofault() could lead to false positives. - * By focusing KASAN checks only on copy_to_kernel_nofault(), - * we ensure that only valid memory is written to the kernel, - * minimizing the risk of kernel corruption while avoiding - * false positives in the reverse case. - */ + * We test copy_to_kernel_nofault() to detect corrupted memory that is + * being written into the kernel. In contrast, + * copy_from_kernel_nofault() is primarily used in kernel helper + * functions where the source address might be random or uninitialized. + * Applying KASAN instrumentation to copy_from_kernel_nofault() could + * lead to false positives. By focusing KASAN checks only on + * copy_to_kernel_nofault(), we ensure that only valid memory is + * written to the kernel, minimizing the risk of kernel corruption + * while avoiding false positives in the reverse case. + */ KUNIT_EXPECT_KASAN_FAIL(test, copy_to_kernel_nofault(&buf[0], ptr, size)); KUNIT_EXPECT_KASAN_FAIL(test, -- 2.50.1