diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-04-16 08:59:07 +0300 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-04-23 22:34:28 +0300 |
commit | adb575124d717b57bb2abb9e63875cb23601c44b (patch) | |
tree | adc98960ad6717a6864445223fbb7cbc57af971a | |
parent | 07836345ba6da5cdad2bbdc43923604d256645f3 (diff) | |
download | u-boot-adb575124d717b57bb2abb9e63875cb23601c44b.tar.xz |
efi_loader: correctly determine length of empty device path
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@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | lib/efi_loader/efi_device_path.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 9b4d9ae0ab..a2e48851d7 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); |