From b1c272d18b50fae1465a8049d5b2802fcc424106 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Mon, 22 Jun 2020 23:50:50 -0700 Subject: cmd: bootefi: Fix fdt_size variable type in efi_carve_out_dt_rsv() Variable fdt_size should be of type 'fdt_size_t', not 'fdt_addr_t'. Fixes 0d7c2913fdf7: ("cmd: bootefi: Honor the address & size cells properties correctly") Signed-off-by: Bin Meng Reviewed-by: Heinrich Schuchardt --- cmd/bootefi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index ac713cad1b6..82691539737 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -189,7 +189,8 @@ static void efi_carve_out_dt_rsv(void *fdt) if (nodeoffset >= 0) { subnode = fdt_first_subnode(fdt, nodeoffset); while (subnode >= 0) { - fdt_addr_t fdt_addr, fdt_size; + fdt_addr_t fdt_addr; + fdt_size_t fdt_size; /* check if this subnode has a reg property */ fdt_addr = fdtdec_get_addr_size_auto_parent( -- cgit v1.2.3 From 915f15ac5746739da0aa2ee2840c2d00dc65aaaa Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 24 Jun 2020 12:14:49 +0200 Subject: efi_loader: type of efi_secure_mode Variable efi_secure_mode is meant to hold a value of enum efi_secure_mode. So it should not be defined as int but as enum efi_secure_mode. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_variable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index e097670e283..4d275b23ce7 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -27,7 +27,7 @@ enum efi_secure_mode { }; static bool efi_secure_boot; -static int efi_secure_mode; +static enum efi_secure_mode efi_secure_mode; static u8 efi_vendor_keys; #define READ_ONLY BIT(31) -- cgit v1.2.3 From d80dd9e7853256f27847238771bf34c7157b8894 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 24 Jun 2020 12:38:00 +0200 Subject: efi_loader: size of secure boot variables The variables SetupMode, AuditMode, DeployedMode are explicitly defined as UINT8 in the UEFI specification. The type of SecureBoot is UINT8 in EDK2. Use variable name secure_boot instead of sec_boot for the value of the UEFI variable SecureBoot. Avoid abbreviations in function descriptions. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_variable.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 4d275b23ce7..6271dbcf41f 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -185,17 +185,17 @@ static const char *parse_attr(const char *str, u32 *attrp, u64 *timep) /** * efi_set_secure_state - modify secure boot state variables - * @sec_boot: value of SecureBoot + * @secure_boot: value of SecureBoot * @setup_mode: value of SetupMode * @audit_mode: value of AuditMode * @deployed_mode: value of DeployedMode * - * Modify secure boot stat-related variables as indicated. + * Modify secure boot status related variables as indicated. * * Return: status code */ -static efi_status_t efi_set_secure_state(int sec_boot, int setup_mode, - int audit_mode, int deployed_mode) +static efi_status_t efi_set_secure_state(u8 secure_boot, u8 setup_mode, + u8 audit_mode, u8 deployed_mode) { u32 attributes; efi_status_t ret; @@ -204,8 +204,8 @@ static efi_status_t efi_set_secure_state(int sec_boot, int setup_mode, EFI_VARIABLE_RUNTIME_ACCESS | READ_ONLY; ret = efi_set_variable_common(L"SecureBoot", &efi_global_variable_guid, - attributes, sizeof(sec_boot), &sec_boot, - false); + attributes, sizeof(secure_boot), + &secure_boot, false); if (ret != EFI_SUCCESS) goto err; -- cgit v1.2.3