[2/5] kasan: unify printk prefixes

Message ID 35589629806cf0840e5f01ec9d8011a7bad648df.1696605143.git.andreyknvl@google.com
State New
Headers
Series kasan: assorted fixes and improvements |

Commit Message

andrey.konovalov@linux.dev Oct. 6, 2023, 3:18 p.m. UTC
  From: Andrey Konovalov <andreyknvl@google.com>

Unify prefixes for printk messages in mm/kasan/.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
---
 mm/kasan/kasan_test.c        | 2 +-
 mm/kasan/kasan_test_module.c | 2 +-
 mm/kasan/quarantine.c        | 4 +++-
 mm/kasan/report_generic.c    | 6 +++---
 4 files changed, 8 insertions(+), 6 deletions(-)
  

Comments

Marco Elver Oct. 9, 2023, 8:43 a.m. UTC | #1
On Fri, 6 Oct 2023 at 17:18, <andrey.konovalov@linux.dev> wrote:
>
> From: Andrey Konovalov <andreyknvl@google.com>
>
> Unify prefixes for printk messages in mm/kasan/.
>
> Signed-off-by: Andrey Konovalov <andreyknvl@google.com>

Reviewed-by: Marco Elver <elver@google.com>

> ---
>  mm/kasan/kasan_test.c        | 2 +-
>  mm/kasan/kasan_test_module.c | 2 +-
>  mm/kasan/quarantine.c        | 4 +++-
>  mm/kasan/report_generic.c    | 6 +++---
>  4 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c
> index b61cc6a42541..c707d6c6e019 100644
> --- a/mm/kasan/kasan_test.c
> +++ b/mm/kasan/kasan_test.c
> @@ -5,7 +5,7 @@
>   * Author: Andrey Ryabinin <a.ryabinin@samsung.com>
>   */
>
> -#define pr_fmt(fmt) "kasan_test: " fmt
> +#define pr_fmt(fmt) "kasan: test: " fmt
>
>  #include <kunit/test.h>
>  #include <linux/bitops.h>
> diff --git a/mm/kasan/kasan_test_module.c b/mm/kasan/kasan_test_module.c
> index 7be7bed456ef..8b7b3ea2c74e 100644
> --- a/mm/kasan/kasan_test_module.c
> +++ b/mm/kasan/kasan_test_module.c
> @@ -5,7 +5,7 @@
>   * Author: Andrey Ryabinin <a.ryabinin@samsung.com>
>   */
>
> -#define pr_fmt(fmt) "kasan test: %s " fmt, __func__
> +#define pr_fmt(fmt) "kasan: test: " fmt
>
>  #include <linux/mman.h>
>  #include <linux/module.h>
> diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
> index 152dca73f398..ca4529156735 100644
> --- a/mm/kasan/quarantine.c
> +++ b/mm/kasan/quarantine.c
> @@ -8,6 +8,8 @@
>   * Based on code by Dmitry Chernenkov.
>   */
>
> +#define pr_fmt(fmt) "kasan: " fmt
> +
>  #include <linux/gfp.h>
>  #include <linux/hash.h>
>  #include <linux/kernel.h>
> @@ -414,7 +416,7 @@ static int __init kasan_cpu_quarantine_init(void)
>         ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mm/kasan:online",
>                                 kasan_cpu_online, kasan_cpu_offline);
>         if (ret < 0)
> -               pr_err("kasan cpu quarantine register failed [%d]\n", ret);
> +               pr_err("cpu quarantine register failed [%d]\n", ret);
>         return ret;
>  }
>  late_initcall(kasan_cpu_quarantine_init);
> diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
> index 51a1e8a8877f..99cbcd73cff7 100644
> --- a/mm/kasan/report_generic.c
> +++ b/mm/kasan/report_generic.c
> @@ -220,7 +220,7 @@ static bool __must_check tokenize_frame_descr(const char **frame_descr,
>                 const size_t tok_len = sep - *frame_descr;
>
>                 if (tok_len + 1 > max_tok_len) {
> -                       pr_err("KASAN internal error: frame description too long: %s\n",
> +                       pr_err("internal error: frame description too long: %s\n",
>                                *frame_descr);
>                         return false;
>                 }
> @@ -233,7 +233,7 @@ static bool __must_check tokenize_frame_descr(const char **frame_descr,
>         *frame_descr = sep + 1;
>
>         if (value != NULL && kstrtoul(token, 10, value)) {
> -               pr_err("KASAN internal error: not a valid number: %s\n", token);
> +               pr_err("internal error: not a valid number: %s\n", token);
>                 return false;
>         }
>
> @@ -323,7 +323,7 @@ static bool __must_check get_address_stack_frame_info(const void *addr,
>
>         frame = (const unsigned long *)(mem_ptr + KASAN_GRANULE_SIZE);
>         if (frame[0] != KASAN_CURRENT_STACK_FRAME_MAGIC) {
> -               pr_err("KASAN internal error: frame info validation failed; invalid marker: %lu\n",
> +               pr_err("internal error: frame has invalid marker: %lu\n",
>                        frame[0]);
>                 return false;
>         }
> --
> 2.25.1
>
  

Patch

diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c
index b61cc6a42541..c707d6c6e019 100644
--- a/mm/kasan/kasan_test.c
+++ b/mm/kasan/kasan_test.c
@@ -5,7 +5,7 @@ 
  * Author: Andrey Ryabinin <a.ryabinin@samsung.com>
  */
 
-#define pr_fmt(fmt) "kasan_test: " fmt
+#define pr_fmt(fmt) "kasan: test: " fmt
 
 #include <kunit/test.h>
 #include <linux/bitops.h>
diff --git a/mm/kasan/kasan_test_module.c b/mm/kasan/kasan_test_module.c
index 7be7bed456ef..8b7b3ea2c74e 100644
--- a/mm/kasan/kasan_test_module.c
+++ b/mm/kasan/kasan_test_module.c
@@ -5,7 +5,7 @@ 
  * Author: Andrey Ryabinin <a.ryabinin@samsung.com>
  */
 
-#define pr_fmt(fmt) "kasan test: %s " fmt, __func__
+#define pr_fmt(fmt) "kasan: test: " fmt
 
 #include <linux/mman.h>
 #include <linux/module.h>
diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index 152dca73f398..ca4529156735 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -8,6 +8,8 @@ 
  * Based on code by Dmitry Chernenkov.
  */
 
+#define pr_fmt(fmt) "kasan: " fmt
+
 #include <linux/gfp.h>
 #include <linux/hash.h>
 #include <linux/kernel.h>
@@ -414,7 +416,7 @@  static int __init kasan_cpu_quarantine_init(void)
 	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mm/kasan:online",
 				kasan_cpu_online, kasan_cpu_offline);
 	if (ret < 0)
-		pr_err("kasan cpu quarantine register failed [%d]\n", ret);
+		pr_err("cpu quarantine register failed [%d]\n", ret);
 	return ret;
 }
 late_initcall(kasan_cpu_quarantine_init);
diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
index 51a1e8a8877f..99cbcd73cff7 100644
--- a/mm/kasan/report_generic.c
+++ b/mm/kasan/report_generic.c
@@ -220,7 +220,7 @@  static bool __must_check tokenize_frame_descr(const char **frame_descr,
 		const size_t tok_len = sep - *frame_descr;
 
 		if (tok_len + 1 > max_tok_len) {
-			pr_err("KASAN internal error: frame description too long: %s\n",
+			pr_err("internal error: frame description too long: %s\n",
 			       *frame_descr);
 			return false;
 		}
@@ -233,7 +233,7 @@  static bool __must_check tokenize_frame_descr(const char **frame_descr,
 	*frame_descr = sep + 1;
 
 	if (value != NULL && kstrtoul(token, 10, value)) {
-		pr_err("KASAN internal error: not a valid number: %s\n", token);
+		pr_err("internal error: not a valid number: %s\n", token);
 		return false;
 	}
 
@@ -323,7 +323,7 @@  static bool __must_check get_address_stack_frame_info(const void *addr,
 
 	frame = (const unsigned long *)(mem_ptr + KASAN_GRANULE_SIZE);
 	if (frame[0] != KASAN_CURRENT_STACK_FRAME_MAGIC) {
-		pr_err("KASAN internal error: frame info validation failed; invalid marker: %lu\n",
+		pr_err("internal error: frame has invalid marker: %lu\n",
 		       frame[0]);
 		return false;
 	}