diff options
| author | João Paulo Rechi Vita <jprvita@endlessos.org> | 2021-03-09 14:06:45 -0800 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-03-10 15:59:07 -0500 |
| commit | 426c5a1e8ada8b8a4374ba37bcb8be16c2ea1d71 (patch) | |
| tree | f26f148069bb1036069dab5d94c133ff3d808302 | |
| parent | 3f6ce534e7e7fdf2b2f610922b7e5167e9252426 (diff) | |
| download | efi-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); |
