diff options
| author | Peter Jones <pjones@redhat.com> | 2022-05-18 15:13:47 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2022-05-18 16:37:23 -0400 |
| commit | 5d789ca4cd9121d81357b0edb75f500dfdcc9ab7 (patch) | |
| tree | 0847011a7617cbfd69cf1cef88bc73d6ef6d785e | |
| parent | f28833f7cbb3f536081b19c8a2cc6f709e772128 (diff) | |
| download | efi-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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; |
