diff --git a/include/ucs2.h b/include/ucs2.h index ee038ce79..87eab32f0 100644 --- a/include/ucs2.h +++ b/include/ucs2.h @@ -63,22 +63,4 @@ StrCSpn(const CHAR16 *s, const CHAR16 *reject) return ret; } -/* - * Test if an entire buffer is nothing but NUL characters. This - * implementation "gracefully" ignores the difference between the - * UTF-8/ASCII 1-byte NUL and the UCS-2 2-byte NUL. - */ -static inline bool -__attribute__((__unused__)) -is_all_nuls(UINT8 *data, UINTN data_size) -{ - UINTN i; - - for (i = 0; i < data_size; i++) { - if (data[i] != 0) - return false; - } - return true; -} - #endif /* SHIM_UCS2_H */ diff --git a/load-options.c b/load-options.c index c6bb74276..67a2d52fd 100644 --- a/load-options.c +++ b/load-options.c @@ -404,8 +404,13 @@ parse_load_options(EFI_LOADED_IMAGE *li) /* * Apparently sometimes we get L"\0\0"? Which isn't useful at all. + * + * Possibly related, but some boards have additional data before the + * size which is garbage (it's a weird path to the directory + * containing the loaders). Known boards that do this: Kontron VX3040 + * (AMI), ASUS B85M-E, and at least one "older Dell laptop". */ - if (is_all_nuls(li->LoadOptions, li->LoadOptionsSize)) + if (((UINT16 *)li->LoadOptions)[0] == 0) return EFI_SUCCESS; /*