hv: handle the case of empty hypervisor cmdline

Fix a bug:
When the hypervisor cmdline is empty, the hypervisor will be
unable to boot up.

Signed-off-by: Jack Ren <jack.ren@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Jack Ren 2018-05-28 13:40:59 +08:00 committed by lijinxia
parent a28c75f5ed
commit 3b616010e0

View File

@ -368,17 +368,15 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *_table)
*/ */
cmdline16 = StrDuplicate(options); cmdline16 = StrDuplicate(options);
bootloader_name = strstr_16(cmdline16, bootloader_param); bootloader_name = strstr_16(cmdline16, bootloader_param);
if (bootloader_name) if (bootloader_name) {
bootloader_name = bootloader_name + StrLen(bootloader_param); bootloader_name = bootloader_name + StrLen(bootloader_param);
n = bootloader_name;
n = bootloader_name; i = 0;
i = 0; while (*n && !isspace((CHAR8)*n) && (*n < 0xff)) {
while (*n && !isspace((CHAR8)*n) && (*n < 0xff)) { n++; i++;
n++; i++; }
} *n++ = '\0';
*n++ = '\0'; } else {
if (!bootloader_name) {
/* /*
* If we reach this point, it means we did not receive a specific * If we reach this point, it means we did not receive a specific
* bootloader name to be used. Fall back to the default bootloader * bootloader name to be used. Fall back to the default bootloader