Skip to contentSkip to conversation

printk: use memblock_alloc_raw() in setup_log_buf()

PATCH New Sang-Heon Jeon 1 participant 1 message Sep 15 Printk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 printk: use memblock_alloc_raw() in setup_log_buf()

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.

---
 kernel/printk/printk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/printk/printk.c +2 -2
index 3fcdf4b4e2e5..fe98d6a86e4a 100644
@@ -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);
Signature · 1 line
2.43.0