aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/zboot.c
diff options
context:
space:
mode:
authorArd Biesheuvel <[email protected]>2022-10-11 15:15:51 +0200
committerArd Biesheuvel <[email protected]>2022-11-09 12:42:02 +0100
commit52dce39cd2786673969a12d1c94e0922d9208f83 (patch)
treeb05c22bae7499c7f1f61430ba296a900bbea75bc /drivers/firmware/efi/libstub/zboot.c
parentfa882a1389b2a6eaba8a0d5439dbd32537d0ecc5 (diff)
efi: libstub: Clone memcmp() into the stub
We will no longer be able to call into the kernel image once we merge the decompressor with the EFI stub, so we need our own implementation of memcmp(). Let's add the one from lib/string.c and simplify it. Signed-off-by: Ard Biesheuvel <[email protected]>
Diffstat (limited to 'drivers/firmware/efi/libstub/zboot.c')
-rw-r--r--drivers/firmware/efi/libstub/zboot.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/firmware/efi/libstub/zboot.c b/drivers/firmware/efi/libstub/zboot.c
index ea72c8f27da6..38173ec29cd5 100644
--- a/drivers/firmware/efi/libstub/zboot.c
+++ b/drivers/firmware/efi/libstub/zboot.c
@@ -47,15 +47,6 @@ static void error(char *x)
log(L"error() called from decompressor library\n");
}
-// Local version to avoid pulling in memcmp()
-static bool guids_eq(const efi_guid_t *a, const efi_guid_t *b)
-{
- const u32 *l = (u32 *)a;
- const u32 *r = (u32 *)b;
-
- return l[0] == r[0] && l[1] == r[1] && l[2] == r[2] && l[3] == r[3];
-}
-
static efi_status_t __efiapi
load_file(efi_load_file_protocol_t *this, efi_device_path_protocol_t *rem,
bool boot_policy, unsigned long *bufsize, void *buffer)
@@ -76,7 +67,7 @@ load_file(efi_load_file_protocol_t *this, efi_device_path_protocol_t *rem,
if (rem->type == EFI_DEV_MEDIA &&
rem->sub_type == EFI_DEV_MEDIA_VENDOR) {
vendor_dp = container_of(rem, struct efi_vendor_dev_path, header);
- if (!guids_eq(&vendor_dp->vendorguid, &LINUX_EFI_ZBOOT_MEDIA_GUID))
+ if (efi_guidcmp(vendor_dp->vendorguid, LINUX_EFI_ZBOOT_MEDIA_GUID))
return EFI_NOT_FOUND;
decompress = true;