summaryrefslogtreecommitdiff
path: root/loader-proto.c
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2025-03-12 16:00:30 -0400
committerPeter Jones <pjones@redhat.com>2025-03-14 11:05:05 -0400
commitdb0432183680121df2fcaba2b697025fef9db6ac (patch)
treed49a3f87f2508885d6ebae56ce7694357e352f08 /loader-proto.c
parent38f0a9c2ee9635cbaab9d7d4aa4664027c913cee (diff)
downloadefi-boot-shim-db0432183680121df2fcaba2b697025fef9db6ac.tar.gz
efi-boot-shim-db0432183680121df2fcaba2b697025fef9db6ac.zip
shim_load_image(): initialize the buffer fully
scan-build notes that we assign bprop.hnd, an EFI_HANDLE for the device path protocol, to our loaded_image->li.DeviceHandle, and it thinks since bprop is uninitialized that means it can be NULL or garbage. I don't think that's actually true, because every path to that requires either returning an error or doing some variety of: status = BS->LocateDevicePath(&gEfiDevicePathProtocolGuid, &bp, &hnd) and checking its error, but only one of those paths explicitly sets a value, and static checkers can't tell what BS->LocateDevicePath does with the pointer. This patch avoids the issue by initializing the whole bprop structure to begin with. Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'loader-proto.c')
-rw-r--r--loader-proto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/loader-proto.c b/loader-proto.c
index 53d35701..4581664b 100644
--- a/loader-proto.c
+++ b/loader-proto.c
@@ -170,7 +170,7 @@ shim_load_image(BOOLEAN BootPolicy, EFI_HANDLE ParentImageHandle,
{
SHIM_LOADED_IMAGE *image;
EFI_STATUS efi_status;
- buffer_properties_t bprop;
+ buffer_properties_t bprop = { NULL, NULL, NULL, 0 };
if (BootPolicy)
return EFI_UNSUPPORTED;