On (09/19/18 01:17), zhe...@windriver.com wrote: > Add KBUILD_MODNAME to make prints more clear.
No strong opinion. I'm OK with this change. > And use 'unsigned int' intead of 'unsigned' according to > checkpatch.pl's suggestion. I don't think that "unsigned int" is the right thing to use there. > if (console_seq < log_first_seq) { > len = sprintf(text, "** %u printk messages dropped > **\n", > - (unsigned)(log_first_seq - console_seq)); > + (unsigned int)(log_first_seq - console_seq)); Both log_first_seq and console_seq are u64. log_first_seq - console_seq thus, *in theory*, can be larger than "unsigned int". So I'd just avoid cast and use an appropriate for u64 %llu sprintf() specifier. Something like below, perhaps: --- diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index f73ea9dd6f46..4b8c5832bf14 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2408,8 +2408,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 int)(log_first_seq - console_seq)); + len = sprintf(text, + "** %llu printk messages dropped **\n", + log_first_seq - console_seq); /* messages are gone, move to first one */ console_seq = log_first_seq; --- Steven, Petr, any objections? -ss