]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
efi_loader: fix hii keyboard layout pointer computation
authorVincent Stehlé <vincent.stehle@arm.com>
Tue, 12 May 2026 17:40:33 +0000 (19:40 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 18 May 2026 06:38:16 +0000 (08:38 +0200)
The EFI_HII_KEYBOARD_LAYOUT field `layout_length' is expressed in bytes,
but we add it to the `layout' pointer with (scaled) pointer arithmetic.
When adding an HII keyboard package with multiple keyboard layouts, this
results in only the first layout being added correctly; fix it.

Fixes: 8d3b77e36e10 ("efi: hii: add keyboard layout package support")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: AKASHI Takahiro <akashi.tkhro@gmail.com>
lib/efi_loader/efi_hii.c

index 330d7c5830b5b5a8d8e69db0205710bce3b6bd97..7bf51ad43d14fd1505a705a26db42eba030fecf2 100644 (file)
@@ -324,7 +324,8 @@ add_keyboard_package(struct efi_hii_packagelist *hii,
                list_add_tail(&layout_data->link_sys,
                              &efi_keyboard_layout_list);
 
-               layout += layout_length;
+               layout = (struct efi_hii_keyboard_layout *)
+                        ((uintptr_t)layout + layout_length);
        }
 
        list_add_tail(&package_data->link, &hii->keyboard_packages);