Commit 178a1877 authored by Marco Elver's avatar Marco Elver Committed by Paul E. McKenney

kcsan: Use pr_fmt for consistency

Use the same pr_fmt throughout for consistency. [ The only exception is
report.c, where the format must be kept precisely as-is. ]
Signed-off-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 27787930
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#define pr_fmt(fmt) "kcsan: " fmt
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/bsearch.h> #include <linux/bsearch.h>
#include <linux/bug.h> #include <linux/bug.h>
...@@ -80,7 +82,7 @@ static noinline void microbenchmark(unsigned long iters) ...@@ -80,7 +82,7 @@ static noinline void microbenchmark(unsigned long iters)
*/ */
WRITE_ONCE(kcsan_enabled, false); WRITE_ONCE(kcsan_enabled, false);
pr_info("KCSAN: %s begin | iters: %lu\n", __func__, iters); pr_info("%s begin | iters: %lu\n", __func__, iters);
cycles = get_cycles(); cycles = get_cycles();
while (iters--) { while (iters--) {
...@@ -91,7 +93,7 @@ static noinline void microbenchmark(unsigned long iters) ...@@ -91,7 +93,7 @@ static noinline void microbenchmark(unsigned long iters)
} }
cycles = get_cycles() - cycles; cycles = get_cycles() - cycles;
pr_info("KCSAN: %s end | cycles: %llu\n", __func__, cycles); pr_info("%s end | cycles: %llu\n", __func__, cycles);
WRITE_ONCE(kcsan_enabled, was_enabled); WRITE_ONCE(kcsan_enabled, was_enabled);
/* restore context */ /* restore context */
...@@ -154,7 +156,7 @@ static ssize_t insert_report_filterlist(const char *func) ...@@ -154,7 +156,7 @@ static ssize_t insert_report_filterlist(const char *func)
ssize_t ret = 0; ssize_t ret = 0;
if (!addr) { if (!addr) {
pr_err("KCSAN: could not find function: '%s'\n", func); pr_err("could not find function: '%s'\n", func);
return -ENOENT; return -ENOENT;
} }
......
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#define pr_fmt(fmt) "kcsan: " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/printk.h> #include <linux/printk.h>
...@@ -116,16 +118,16 @@ static int __init kcsan_selftest(void) ...@@ -116,16 +118,16 @@ static int __init kcsan_selftest(void)
if (do_test()) \ if (do_test()) \
++passed; \ ++passed; \
else \ else \
pr_err("KCSAN selftest: " #do_test " failed"); \ pr_err("selftest: " #do_test " failed"); \
} while (0) } while (0)
RUN_TEST(test_requires); RUN_TEST(test_requires);
RUN_TEST(test_encode_decode); RUN_TEST(test_encode_decode);
RUN_TEST(test_matching_access); RUN_TEST(test_matching_access);
pr_info("KCSAN selftest: %d/%d tests passed\n", passed, total); pr_info("selftest: %d/%d tests passed\n", passed, total);
if (passed != total) if (passed != total)
panic("KCSAN selftests failed"); panic("selftests failed");
return 0; return 0;
} }
postcore_initcall(kcsan_selftest); postcore_initcall(kcsan_selftest);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment