boot1: avoid using NULL device path
As of r323063 boot1 printed out the path & device from which it was loaded, but uboot's EFI implementation lacked some support, resulting in a NULL pointer and a crash. Check for a NULL pointer and avoid reporting (and storing in the environment) the device and path in this case. Submitted by: Zakary Nafziger <worldofzak@gmail.com> MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13038
This commit is contained in:
parent
28fe4b67af
commit
dacbdb94ef
@ -460,22 +460,23 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
|
||||
imgpath = NULL;
|
||||
if (status == EFI_SUCCESS) {
|
||||
text = efi_devpath_name(img->FilePath);
|
||||
printf(" Load Path: %S\n", text);
|
||||
efi_setenv_freebsd_wcs("Boot1Path", text);
|
||||
efi_free_devpath_name(text);
|
||||
|
||||
status = BS->HandleProtocol(img->DeviceHandle, &DevicePathGUID,
|
||||
(void **)&imgpath);
|
||||
if (status != EFI_SUCCESS) {
|
||||
DPRINTF("Failed to get image DevicePath (%lu)\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
} else {
|
||||
text = efi_devpath_name(imgpath);
|
||||
printf(" Load Device: %S\n", text);
|
||||
efi_setenv_freebsd_wcs("Boot1Dev", text);
|
||||
if (text != NULL) {
|
||||
printf(" Load Path: %S\n", text);
|
||||
efi_setenv_freebsd_wcs("Boot1Path", text);
|
||||
efi_free_devpath_name(text);
|
||||
}
|
||||
|
||||
status = BS->HandleProtocol(img->DeviceHandle,
|
||||
&DevicePathGUID, (void **)&imgpath);
|
||||
if (status != EFI_SUCCESS) {
|
||||
DPRINTF("Failed to get image DevicePath (%lu)\n",
|
||||
EFI_ERROR_CODE(status));
|
||||
} else {
|
||||
text = efi_devpath_name(imgpath);
|
||||
printf(" Load Device: %S\n", text);
|
||||
efi_setenv_freebsd_wcs("Boot1Dev", text);
|
||||
efi_free_devpath_name(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Get all the device handles */
|
||||
|
Loading…
Reference in New Issue
Block a user