[PATCH 2/3] efi_loader: EFI_VARIABLE_READ_ONLY should be 32bit

Ilias Apalodimas ilias.apalodimas at linaro.org
Wed Apr 3 17:37:17 CEST 2024


On Wed, 3 Apr 2024 at 18:34, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> 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 at canonical.com>
> ---
>  include/efi_variable.h        | 2 +-
>  lib/efi_loader/efi_variable.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/efi_variable.h b/include/efi_variable.h
> index 805e6c5f1e0..42a2b7c52be 100644
> --- a/include/efi_variable.h
> +++ b/include/efi_variable.h
> @@ -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,
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index efe17d98f5a..48ad813d79b 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -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;
> --
> 2.43.0
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>


More information about the U-Boot mailing list