summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-04-25 23:35:01 +0200
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-04-29 14:25:39 +0200
commit4f419960bff5bbc646e28da3f8c953455319ea16 (patch)
tree442aeeeaf967e7cb2c6e581e437bc1aed144b1ea /lib
parentdd1086ac6bda9d464abc9be6a7e24a843b9bf30b (diff)
downloadu-boot-4f419960bff5bbc646e28da3f8c953455319ea16.tar.gz
efi_loader: simplify try_load_entry()
Use function efi_create_indexed_name() to create the BootXXXX variable name. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_bootmgr.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index d1c14f1bbc..52bea4d541 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -46,16 +46,12 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
void **load_options)
{
struct efi_load_option lo;
- u16 varname[] = u"Boot0000";
- u16 hexmap[] = u"0123456789ABCDEF";
+ u16 varname[9];
void *load_option;
efi_uintn_t size;
efi_status_t ret;
- varname[4] = hexmap[(n & 0xf000) >> 12];
- varname[5] = hexmap[(n & 0x0f00) >> 8];
- varname[6] = hexmap[(n & 0x00f0) >> 4];
- varname[7] = hexmap[(n & 0x000f) >> 0];
+ efi_create_indexed_name(varname, sizeof(varname), "Boot", n);
load_option = efi_get_var(varname, &efi_global_variable_guid, &size);
if (!load_option)