diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2019-02-01 17:26:08 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-02-05 10:34:49 +0100 |
commit | ea5736805190e912903c27c9f17c7a4341a405e9 (patch) | |
tree | cc5eae5f498457b244da24775b0425f520bb5286 /arch/arm64/kernel/machine_kexec_file.c | |
parent | arm64: ptdump: Don't iterate kernel page tables using PTRS_PER_PXX (diff) | |
download | linux-ea5736805190e912903c27c9f17c7a4341a405e9.tar.xz linux-ea5736805190e912903c27c9f17c7a4341a405e9.zip |
arm64: kexec_file: handle empty command-line
Calling strlen() on cmdline == NULL produces a kernel oops. Since having
a NULL cmdline is valid, handle this case explicitly.
Fixes: 52b2a8af7436 ("arm64: kexec_file: load initrd and device-tree")
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/machine_kexec_file.c')
-rw-r--r-- | arch/arm64/kernel/machine_kexec_file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index f2c211a6229b..58871333737a 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c @@ -120,10 +120,12 @@ static int create_dtb(struct kimage *image, { void *buf; size_t buf_size; + size_t cmdline_len; int ret; + cmdline_len = cmdline ? strlen(cmdline) : 0; buf_size = fdt_totalsize(initial_boot_params) - + strlen(cmdline) + DTB_EXTRA_SPACE; + + cmdline_len + DTB_EXTRA_SPACE; for (;;) { buf = vmalloc(buf_size); |