Thread (47 messages) flat view 47 messages, 5 authors, 2021-01-15

Re: [PATCH 03/11] kasan: clean up comments in tests

From: Alexander Potapenko <glider@google.com>
Date: 2021-01-12 07:54:33
Also in: linux-mm, lkml

On Tue, Jan 5, 2021 at 7:28 PM Andrey Konovalov [off-list ref] wrote:
Clarify and update comments and info messages in KASAN tests.

Signed-off-by: Andrey Konovalov <redacted>
Link: https://linux-review.googlesource.com/id/I6c816c51fa1e0eb7aa3dead6bda1f339d2af46c8
 void *kasan_ptr_result;
 int kasan_int_result;
Shouldn't these two variables be static, by the way?
quoted hunk ↗ jump to hunk
@@ -39,14 +38,13 @@ static struct kunit_resource resource;
 static struct kunit_kasan_expectation fail_data;
 static bool multishot;

+/*
+ * Temporarily enable multi-shot mode. Otherwise, KASAN would only report the
+ * first detected bug and panic the kernel if panic_on_warn is enabled.
+ */
YMMV, but I think this comment was at its place already.
 static int kasan_test_init(struct kunit *test)
 {
-       /*
-        * Temporarily enable multi-shot mode and set panic_on_warn=0.
-        * Otherwise, we'd only get a report for the first case.
-        */
        multishot = kasan_save_enable_multi_shot();
Unrelated to this change, but have you considered storing
test-specific data in test->priv instead of globals?
        if (!IS_ENABLED(CONFIG_SLUB)) {
-               kunit_info(test, "CONFIG_SLUB is not enabled.");
+               kunit_info(test, "skipping, CONFIG_SLUB required");
                return;
        }
You may want to introduce a macro that takes a config name and prints
the warning/returns if it's not enabled.

Alex

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help