]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: EFI_VARIABLE_READ_ONLY should be 32bit
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 3 Apr 2024 15:33:34 +0000 (17:33 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 8 Apr 2024 11:03:31 +0000 (13:03 +0200)
GetVariable() and SetVariable() only accept a 32bit value for attributes.
It makes not sense to define EFI_VARIABLE_READ_ONLY as unsigned long.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
include/efi_variable.h
lib/efi_loader/efi_variable.c

index 805e6c5f1e08ce2de95e9f061a883b1691a0767b..42a2b7c52bef7b5714e3206bbbc3132fc26fa976 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <linux/bitops.h>
 
-#define EFI_VARIABLE_READ_ONLY BIT(31)
+#define EFI_VARIABLE_READ_ONLY 0x80000000
 
 enum efi_auth_var_type {
        EFI_AUTH_VAR_NONE = 0,
index 8f5538280219c1bb03fd25df4ba47d0eb29013a5..b2f8ebdd78e1153208f0f1a24933b5dfcfda41a3 100644 (file)
@@ -276,8 +276,8 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
                /* attributes won't be changed */
                if (!delete &&
                    ((ro_check && var->attr != attributes) ||
-                    (!ro_check && ((var->attr & ~(u32)EFI_VARIABLE_READ_ONLY)
-                                   != (attributes & ~(u32)EFI_VARIABLE_READ_ONLY))))) {
+                    (!ro_check && ((var->attr & ~EFI_VARIABLE_READ_ONLY)
+                                   != (attributes & ~EFI_VARIABLE_READ_ONLY))))) {
                        return EFI_INVALID_PARAMETER;
                }
                time = var->time;