Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fallback: fix crash when boot entry index >= size of BootOrder list
Seen on Dell PowerEdge R740 when booting with BOOTX64 constantly. This patch keeps the behaviour previous to commit #1b30c2b by returning the index of the "Linux" entry. Then a check is made to find the entry in the current BootOrder: - if it isn't there, prepend the entry and copy the rest (this enlarges the BootOrder array by 1) - if it's there, prepend the entry and copy all remaining entries ------------------------------------------------------------------------------ Example of outputs on a Dell PowerEdge R740: - 0000 is BOOTX64 entry - other entries are Dell's default ones (internal, no "Linux" there) 1. Entry not already existing in BootOrder ---- set_boot_order:486: Original nbootorder: 3 Original BootOrder: 0000 0003 0004 : add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi" find_boot_option:454: Found boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi" add_to_boot_list:623: New nbootorder: 4 BootOrder: 0005 0000 0003 0004 find_boot_options:937: Found directory named "Dell" update_boot_order:509: nbootorder: 4 BootOrder: 0005 0000 0003 0004 ---- 2. Entry not existing at all ---- set_boot_order:486: Original nbootorder: 3 Original BootOrder: 0000 0001 0002 : add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi" add_boot_option:245: Creating boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi" add_boot_option:282: nbootorder: 4 BootOrder: 0005 0000 0001 0002 find_boot_options:937: Found directory named "Dell" update_boot_order:509: nbootorder: 4 BootOrder: 0005 0000 0001 0002 ---- 3. Entry already existing in BootOrder ---- set_boot_order:486: Original nbootorder: 4 Original BootOrder: 0000 0005 0001 0002 : add_to_boot_list:578: device path: "HD(1,GPT,99D47E76-590F-48FD-8FD6-0A0CE790D635)/\EFI\redhat\shimx64.efi" find_boot_option:454: Found boot entry "Boot0005" with label "Red Hat Enterprise Linux" for file "\EFI\redhat\shimx64.efi" add_to_boot_list:623: New nbootorder: 4 BootOrder: 0005 0000 0001 0002 find_boot_options:937: Found directory named "Dell" update_boot_order:509: nbootorder: 4 BootOrder: 0005 0000 0001 0002 ----
- Loading branch information