From 426c5a1e8ada8b8a4374ba37bcb8be16c2ea1d71 Mon Sep 17 00:00:00 2001 From: João Paulo Rechi Vita Date: Tue, 9 Mar 2021 14:06:45 -0800 Subject: fallback: Store label size instead of calculating on every use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Paulo Rechi Vita --- fallback.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fallback.c') 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); -- cgit v1.2.3