summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2022-05-18 15:13:47 -0400
committerPeter Jones <pjones@redhat.com>2022-05-18 16:37:23 -0400
commit5d789ca4cd9121d81357b0edb75f500dfdcc9ab7 (patch)
tree0847011a7617cbfd69cf1cef88bc73d6ef6d785e
parentf28833f7cbb3f536081b19c8a2cc6f709e772128 (diff)
downloadefi-boot-shim-5d789ca4cd9121d81357b0edb75f500dfdcc9ab7.tar.gz
efi-boot-shim-5d789ca4cd9121d81357b0edb75f500dfdcc9ab7.zip
Always initialize data/datasize before calling read_image()
scan-build noticed that there's a path where we'll pass some data from the read_image() to e.g. the string functions, but it might be an unassigned pointer on one of the code paths. I don't think you can actually hit it without returning from an error first, but best to initialize these anyway. This patch initializes data to NULL and datasize to 0. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--shim.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/shim.c b/shim.c
index c4f9461a..80b11709 100644
--- a/shim.c
+++ b/shim.c
@@ -1138,7 +1138,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
UINTN alloc_pages;
CHAR16 *PathName = NULL;
void *data = NULL;
- int datasize;
+ int datasize = 0;
efi_status = read_image(image_handle, ImagePath, PathName, &data,
&datasize);
@@ -1402,13 +1402,12 @@ load_cert_file(EFI_HANDLE image_handle, CHAR16 *filename)
CHAR16 *PathName = NULL;
void *pointer;
UINT32 original;
- int datasize;
- void *data;
+ int datasize = 0;
+ void *data = NULL;
int i;
efi_status = read_image(image_handle, filename, PathName,
&data, &datasize);
-
if (EFI_ERROR(efi_status))
return efi_status;