Re: [PATCH v3 2/2] printk: Add KBUILD_MODNAME and correct wrong casting
From: Petr Mladek
Date: Tue Sep 25 2018 - 07:34:52 EST
On Sat 2018-09-22 23:40:52, zhe.he@xxxxxxxxxxxxx wrote:
> From: He Zhe <zhe.he@xxxxxxxxxxxxx>
>
> Add KBUILD_MODNAME to make prints more clear and correct wrong casting that
> might cut off the normal output.
>
> Signed-off-by: He Zhe <zhe.he@xxxxxxxxxxxxx>
> Cc: pmladek@xxxxxxxx
> Cc: sergey.senozhatsky@xxxxxxxxx
> Cc: rostedt@xxxxxxxxxxx
> ---
> v2:
> Correct one more place
> v3:
> Correct wrong casting
>
> kernel/printk/printk.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index d9821c0..6b059a0 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -16,6 +16,8 @@
> * 01Mar01 Andrew Morton
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
This patch should remove all explicit prefixes to avoid duplication.
I see one:
pr_info("printk: continuation disabled due to ext consoles, expect more fragments in /dev/kmsg\n");
> #include <linux/kernel.h>
> #include <linux/mm.h>
> #include <linux/tty.h>
> @@ -2358,8 +2360,9 @@ void console_unlock(void)
> printk_safe_enter_irqsave(flags);
> raw_spin_lock(&logbuf_lock);
> if (console_seq < log_first_seq) {
> - len = sprintf(text, "** %u printk messages dropped **\n",
> - (unsigned)(log_first_seq - console_seq));
> + len = sprintf(text,
> + "** %llu printk messages dropped **\n",
> + log_first_seq - console_seq);
On the contrary, please, put this fix into a separate patch. It is a
candidate for stable backports.
Best Regards,
Petr