mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
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: 52b2a8af74
("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>
This commit is contained in:
parent
d23c808c6f
commit
ea57368051
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user