From db0432183680121df2fcaba2b697025fef9db6ac Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 12 Mar 2025 16:00:30 -0400 Subject: 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 --- loader-proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'loader-proto.c') 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; -- cgit v1.2.3