mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] printk: use memblock_alloc_raw() in setup_log_buf()
@ 2026-09-15 15:02 Sang-Heon Jeon
  0 siblings, 0 replies; only message in thread
From: Sang-Heon Jeon @ 2026-09-15 15:02 UTC (permalink / raw)
  To: Petr Mladek; +Cc: John Ogness, linux-kernel, Sergey Senozhatsky, Steven Rostedt

setup_log_buf() allocates the prb_desc and printk_info arrays with
memblock_alloc(), which returns zero-initialized memory. prb_init() then
zeroes both arrays, and nothing uses them in between.

So allocate both arrays with memblock_alloc_raw() instead.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 kernel/printk/printk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3fcdf4b4e2e5..fe98d6a86e4a 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1197,7 +1197,7 @@ void __init setup_log_buf(int early)
 	}
 
 	new_descs_size = new_descs_count * sizeof(struct prb_desc);
-	new_descs = memblock_alloc(new_descs_size, LOG_ALIGN);
+	new_descs = memblock_alloc_raw(new_descs_size, LOG_ALIGN);
 	if (unlikely(!new_descs)) {
 		pr_err("log_buf_len: %zu desc bytes not available\n",
 		       new_descs_size);
@@ -1205,7 +1205,7 @@ void __init setup_log_buf(int early)
 	}
 
 	new_infos_size = new_descs_count * sizeof(struct printk_info);
-	new_infos = memblock_alloc(new_infos_size, LOG_ALIGN);
+	new_infos = memblock_alloc_raw(new_infos_size, LOG_ALIGN);
 	if (unlikely(!new_infos)) {
 		pr_err("log_buf_len: %zu info bytes not available\n",
 		       new_infos_size);
-- 
2.43.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-15 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 15:02 [PATCH] printk: use memblock_alloc_raw() in setup_log_buf() Sang-Heon Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®