loader.efi: efi_devpath_is_prefix should return bool
efi_devpath_is_prefix() is currently returning values 0 or 1, which means it really should return bool. Additionally, use unsigned len, because we only get unsigned values from DevicePathNodeLength().
This commit is contained in:
parent
51458520c7
commit
c2e27b84ac
@ -82,7 +82,7 @@ EFI_HANDLE efi_devpath_handle(EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_devpath_last_node(EFI_DEVICE_PATH *);
|
||||
EFI_DEVICE_PATH *efi_devpath_trim(EFI_DEVICE_PATH *);
|
||||
bool efi_devpath_match(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
int efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *);
|
||||
CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *);
|
||||
void efi_free_devpath_name(CHAR16 *);
|
||||
|
||||
|
@ -167,13 +167,13 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2)
|
||||
return (true);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
|
||||
{
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
if (prefix == NULL || path == NULL)
|
||||
return (0);
|
||||
return (false);
|
||||
|
||||
while (1) {
|
||||
if (IsDevicePathEnd(prefix))
|
||||
@ -181,17 +181,17 @@ efi_devpath_is_prefix(EFI_DEVICE_PATH *prefix, EFI_DEVICE_PATH *path)
|
||||
|
||||
if (DevicePathType(prefix) != DevicePathType(path) ||
|
||||
DevicePathSubType(prefix) != DevicePathSubType(path))
|
||||
return (0);
|
||||
return (false);
|
||||
|
||||
len = DevicePathNodeLength(prefix);
|
||||
if (len != DevicePathNodeLength(path))
|
||||
return (0);
|
||||
return (false);
|
||||
|
||||
if (memcmp(prefix, path, (size_t)len) != 0)
|
||||
return (0);
|
||||
if (memcmp(prefix, path, len) != 0)
|
||||
return (false);
|
||||
|
||||
prefix = NextDevicePathNode(prefix);
|
||||
path = NextDevicePathNode(path);
|
||||
}
|
||||
return (1);
|
||||
return (true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user