summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/setup.c
diff options
context:
space:
mode:
authorTiezhu Yang <yangtiezhu@loongson.cn>2022-05-24 04:27:49 +0200
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2022-05-24 13:04:53 +0200
commitfb3d6967d508a59b2e8df8358aad1c35579a2833 (patch)
treecd5e4b77d8bec43f2be94234968fa1050ee89abb /arch/mips/kernel/setup.c
parentMIPS: Kconfig: Fix indentation and add endif comment (diff)
downloadlinux-fb3d6967d508a59b2e8df8358aad1c35579a2833.tar.xz
linux-fb3d6967d508a59b2e8df8358aad1c35579a2833.zip
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 <yangtiezhu@loongson.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/kernel/setup.c')
-rw-r--r--arch/mips/kernel/setup.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index ad3aea81d0e2..1c7f91622d91 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -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