efi_loader: add comments on efi_file_from_path() regarding alignment
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 10 Nov 2022 13:31:30 +0000 (15:31 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Wed, 16 Nov 2022 07:34:06 +0000 (08:34 +0100)
UEFI specification requires pointers that are passed to protocol member
functions to be aligned.  There's a u16_strdup in that function which
doesn't make sense otherwise  Add a comment so no one removes it
accidentally

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

index 8b9fa58..b1495e5 100644 (file)
@@ -1144,6 +1144,11 @@ struct efi_file_handle *efi_file_from_path(struct efi_device_path *fp)
                        return NULL;
                }
 
+               /*
+                * UEFI specification requires pointers that are passed to
+                * protocol member functions to be aligned.  So memcpy it
+                * unconditionally
+                */
                filename = u16_strdup(fdp->str);
                if (!filename)
                        return NULL;