diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 6f598f92f2a1..32ad0c7a0cd3 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -828,15 +828,21 @@ void log_buf_kexec_setup(void) /* requested log_buf_len from kernel cmdline */ static unsigned long __initdata new_log_buf_len; +/* we practice scaling the ring buffer by powers of 2 */ +static void __init log_buf_len_update(unsigned size) +{ + if (size) + size = roundup_pow_of_two(size); + if (size > log_buf_len) + new_log_buf_len = size; +} + /* save requested log_buf_len since it's too early to process it */ static int __init log_buf_len_setup(char *str) { unsigned size = memparse(str, &str); - if (size) - size = roundup_pow_of_two(size); - if (size > log_buf_len) - new_log_buf_len = size; + log_buf_len_update(size); return 0; }