Message ID | 20200527232602.21596-1-nivedita@alum.mit.edu |
---|---|
State | New |
Headers | show |
Series | efi/x86: Don't blow away existing initrd | expand |
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 072b7cf40475..ceb8e16c8b75 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -774,10 +774,12 @@ unsigned long efi_main(efi_handle_t handle, efi_err("Failed to load initrd!\n"); goto fail; } - efi_set_u64_split(addr, &hdr->ramdisk_image, - &boot_params->ext_ramdisk_image); - efi_set_u64_split(size, &hdr->ramdisk_size, - &boot_params->ext_ramdisk_size); + if (size > 0) { + efi_set_u64_split(addr, &hdr->ramdisk_image, + &boot_params->ext_ramdisk_image); + efi_set_u64_split(size, &hdr->ramdisk_size, + &boot_params->ext_ramdisk_size); + } } /*