[U-Boot] [PATCH v2 5/8] efi_loader: correctly determine length of empty device path
Heinrich Schuchardt
xypron.glpk at gmx.de
Mon Apr 16 05:59:07 UTC 2018
efi_dp_size() is meant to return the device path length without the end
node.
The length of a device path containing only an end node was incorrectly
reported as 4.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
no change
---
lib/efi_loader/efi_device_path.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 531a754427..46d3fea732 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -234,6 +234,8 @@ unsigned efi_dp_size(const struct efi_device_path *dp)
{
unsigned sz = 0;
+ if (!dp || dp->type == DEVICE_PATH_TYPE_END)
+ return 0;
while (dp) {
sz += dp->length;
dp = efi_dp_next(dp);
--
2.17.0
More information about the U-Boot
mailing list