diff options
| author | Peter Jones <pjones@redhat.com> | 2017-10-19 13:53:56 -0400 |
|---|---|---|
| committer | Peter Jones <pmjones@gmail.com> | 2018-03-12 16:21:43 -0400 |
| commit | f80b30febc947a3ac2ee0efdc621c8e51733b8b1 (patch) | |
| tree | 19d904fe15adf15cc8b115bd19e50c6055c7a512 /shim.c | |
| parent | 3b56e56a43864ba584c455365b2108ff2ceaed5a (diff) | |
| download | efi-boot-shim-f80b30febc947a3ac2ee0efdc621c8e51733b8b1.tar.gz efi-boot-shim-f80b30febc947a3ac2ee0efdc621c8e51733b8b1.zip | |
shim: generate_hash(): make clang-analyzer not get confused.
clang-analyzer thinks that because we're not checking for NULL from
ImageAddress() it can be NULL, but doesn't realize we've already checked
that value once before.
Check it again, it can't hurt.
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'shim.c')
| -rw-r--r-- | shim.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -847,6 +847,19 @@ static EFI_STATUS generate_hash (char *data, unsigned int datasize_in, sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) + context->PEHdr->Pe32.FileHeader.SizeOfOptionalHeader); + /* But check it again just for better error messaging, and so + * clang-analyzer doesn't get confused. */ + if (Section == NULL) { + uint64_t addr; + + addr = PEHdr_offset + sizeof(UINT32) + sizeof(EFI_IMAGE_FILE_HEADER) + + context->PEHdr->Pe32.FileHeader.SizeOfOptionalHeader; + perror(L"Malformed file header.\n"); + perror(L"Image address for Section 0 is 0x%016llx\n", addr); + perror(L"File size is 0x%016llx\n", datasize); + efi_status = EFI_INVALID_PARAMETER; + goto done; + } /* Sort the section headers */ for (index = 0; index < context->PEHdr->Pe32.FileHeader.NumberOfSections; index++) { |
