summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Paulo Rechi Vita <jprvita@endlessos.org>2021-03-09 14:06:45 -0800
committerPeter Jones <pjones@redhat.com>2021-03-10 15:59:07 -0500
commit426c5a1e8ada8b8a4374ba37bcb8be16c2ea1d71 (patch)
treef26f148069bb1036069dab5d94c133ff3d808302
parent3f6ce534e7e7fdf2b2f610922b7e5167e9252426 (diff)
downloadefi-boot-shim-426c5a1e8ada8b8a4374ba37bcb8be16c2ea1d71.tar.gz
efi-boot-shim-426c5a1e8ada8b8a4374ba37bcb8be16c2ea1d71.zip
fallback: Store label size instead of calculating on every use
Signed-off-by: João Paulo Rechi Vita <jprvita@endlessos.org>
-rw-r--r--fallback.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fallback.c b/fallback.c
index ba90bb3b..bf8a491e 100644
--- a/fallback.c
+++ b/fallback.c
@@ -394,8 +394,9 @@ find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
CHAR16 *filename, CHAR16 *label, CHAR16 *arguments,
UINT16 *optnum)
{
+ unsigned int label_size = StrLen(label)*2 + 2;
unsigned int size = sizeof(UINT32) + sizeof (UINT16) +
- StrLen(label)*2 + 2 + DevicePathSize(dp) +
+ label_size + DevicePathSize(dp) +
StrLen(arguments) * 2;
CHAR8 *data = AllocateZeroPool(size + 2);
@@ -407,7 +408,7 @@ find_boot_option(EFI_DEVICE_PATH *dp, EFI_DEVICE_PATH *fulldp,
*(UINT16 *)cursor = DevicePathSize(dp);
cursor += sizeof (UINT16);
StrCpy((CHAR16 *)cursor, label);
- cursor += StrLen(label)*2 + 2;
+ cursor += label_size;
CopyMem(cursor, dp, DevicePathSize(dp));
cursor += DevicePathSize(dp);
StrCpy((CHAR16 *)cursor, arguments);