Skip to content

Commit

Permalink
MIPS: Return -EINVAL if mem parameter is empty in early_parse_mem()
Browse files Browse the repository at this point in the history
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 <yangtiezhu@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  • Loading branch information
Tiezhu Yang authored and Thomas Bogendoerfer committed May 24, 2022
1 parent 31f12fd commit fb3d696
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ static int __init early_parse_mem(char *p)
{
phys_addr_t start, size;

if (!p) {
pr_err("mem parameter is empty, do nothing\n");
return -EINVAL;
}

/*
* If a user specifies memory size, we
* blow away any automatically generated
Expand Down

0 comments on commit fb3d696

Please sign in to comment.