xen/efi: Use blexit() instead of BUG_ON() in read_file()
PATCH v2 1/1 xen/efi: Use blexit() instead of BUG_ON() in read_file()
Follow-up to 880e40b187aa, which added a BUG_ON() guard in read_file().
But as Jan pointed out, before ExitBootServices BUG_ON() is not functional. It results in a hang with no message.
On the other hand blexit() prints a message and returns back to the bootloader.
---
Changes in v2:
- Drop the Link: tag; use Reported-by: and Fixes: instead. (Jan)
blexit() has been chosen over PrintErrMesg(), as the latter is predominantly used in cases where an EFI call fails (and it prints the status).
xen/common/efi/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/efi/boot.c +2 -1
@@ -849,7 +849,8 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,if ( !name )PrintErrMesg (L"No filename" ,EFI_OUT_OF_RESOURCES ); -BUG_ON (!dir_handle); +if ( !dir_handle ) +blexit (L"BUG: !dir_handle in read_file()" ); what =L"Open" ; ret = dir_handle->Open(dir_handle, &FileHandle, name,
Signature · 1 line
2.53.0
Quoted 5 lines · Szymon Acedański
Follow-up to
880e40b187aa, which added aBUG_ON()guard inread_file().But as Jan pointed out, before ExitBootServices
BUG_ON()is not functional. It results in a hang with no message.
Quoted 7 lines
On the other hand
blexit()prints a message and returns back to the bootloader.Fixes 880e40b187aa ("xen/efi: Fix boot from a device without a file system")Reported-by Jan Beulich <[email protected]>Signed-off-by Szymon Acedański <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Quoted 29 lines
---
Changes in v2:
- Drop the Link: tag; use Reported-by: and Fixes: instead. (Jan)
blexit()has been chosen overPrintErrMesg(), as the latter is predominantly used in cases where an EFI call fails (and it prints the status).xen/common/efi/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)xen/common/efi/boot.c +2
-1@@ -849,7 +849,8 @@ static bool __init read_file(EFI_FILE_HANDLE dir_handle, CHAR16 *name,if ( !name )PrintErrMesg (L"No filename" ,EFI_OUT_OF_RESOURCES ); -BUG_ON (!dir_handle); +if ( !dir_handle ) +blexit (L"BUG: !dir_handle in read_file()" ); what =L"Open" ; ret = dir_handle->Open(dir_handle, &FileHandle, name,Signature · 1 line
2.53.0
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Quoted 5 lines · Szymon Acedański
Follow-up to
880e40b187aa, which added aBUG_ON()guard inread_file().But as Jan pointed out, before ExitBootServices
BUG_ON()is not functional. It results in a hang with no message.
Quoted 7 lines
On the other hand
blexit()prints a message and returns back to the bootloader.Fixes 880e40b187aa ("xen/efi: Fix boot from a device without a file system")Reported-by Jan Beulich <[email protected]>Signed-off-by Szymon Acedański <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Thanks.
~ Oleksii