From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Date: Thu, 10 Nov 2022 13:31:30 +0000 (+0200)
Subject: efi_loader: add comments on efi_file_from_path() regarding alignment
X-Git-Tag: v2025.01-rc5-pxa1908~1210^2~2
X-Git-Url: http://git.dujemihanovic.xyz/html/index.html?a=commitdiff_plain;h=94a574d8f6116a12def77fbf9a92f02a430a1d12;p=u-boot.git

efi_loader: add comments on efi_file_from_path() regarding alignment

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>
---

diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 8b9fa5885a..b1495e58ee 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -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;