MdeModulePkg: UefiBootManagerLib: Update assert condition

In BmFindBootOptionInVariable() we prevent passing a NULL pointer to
EfiBootManagerFindLoadOption().  However, it can accept a NULL pointer as
the second argument as long as count is zero.  This change updates the
assert condtion to only assert if the pointer is NULL and the count is
non-zero.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
This commit is contained in:
Ken Lautner 2024-08-27 13:21:47 -07:00 committed by mergify[bot]
parent 03bc4252fb
commit f0dc9e1504

View File

@ -147,6 +147,12 @@ BmFindBootOptionInVariable (
if (OptionNumber == LoadOptionNumberUnassigned) {
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);
// Only assert if the BootOption is non-zero
if ((BootOptions == NULL) && (BootOptionCount > 0)) {
ASSERT (BootOptions != NULL);
return LoadOptionNumberUnassigned;
}
Index = EfiBootManagerFindLoadOption (OptionToFind, BootOptions, BootOptionCount);
if (Index != -1) {
OptionNumber = BootOptions[Index].OptionNumber;