Skip to content

Commit fb3d696

Browse files
seehearfeeltsbogend
authored andcommitted
MIPS: Return -EINVAL if mem parameter is empty in early_parse_mem()
In the current code, the users usually need to make sure the value of mem parameter is correct, but it is better to do some check to avoid potential boot hangs. This commit checks whether mem parameter is empty, if yes, return -EINVAL before call memblock_remove() and memblock_add(). Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 31f12fd commit fb3d696

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/mips/kernel/setup.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ static int __init early_parse_mem(char *p)
344344
{
345345
phys_addr_t start, size;
346346

347+
if (!p) {
348+
pr_err("mem parameter is empty, do nothing\n");
349+
return -EINVAL;
350+
}
351+
347352
/*
348353
* If a user specifies memory size, we
349354
* blow away any automatically generated

0 commit comments

Comments
 (0)