lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] MIPS: Fix unable to allocate memory for crashkernel
Date
Use 0 as the align parameter in memblock_find_in_range() is
incorrect when we allocate memory for crashkernel. It's
finally used as by round_down(). Like this call tree:

mm/memblock.c

memblock_find_in_range
└── memblock_find_in_range_node
├── __memblock_find_range_bottom_up
│ └── round_down
└── __memblock_find_range_top_down
└── round_down

However, the round_down's second parameter must be a power of 2.
The author mean not align. So change it from 0 to 1.

Signed-off-by: Jinyang He <hejinyang@loongson.cn>
---
arch/mips/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7b537fa..588b212 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -497,7 +497,7 @@ static void __init mips_parse_crashkernel(void)
if (ret != 0 || crash_size <= 0)
return;

- if (!memblock_find_in_range(crash_base, crash_base + crash_size, crash_size, 0)) {
+ if (!memblock_find_in_range(crash_base, crash_base + crash_size, crash_size, 1)) {
pr_warn("Invalid memory region reserved for crash kernel\n");
return;
}
--
2.1.0
\
 
 \ /
  Last update: 2020-07-22 12:25    [W:0.032 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site