acpi: verify file entries in bios_linker_loader_add_pointer()

The callers to bios_linker_find_file() assert that the file entry returned
is not NULL, except for those in bios_linker_loader_add_pointer().  Add two
asserts in that case for completeness and to facilitate static code analysis.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Message-Id: <1553199229-25318-1-git-send-email-liam.merwick@oracle.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Liam Merwick 2019-03-21 20:13:49 +00:00 committed by Michael S. Tsirkin
parent 436960c959
commit 22132828d1
1 changed files with 2 additions and 0 deletions

View File

@ -283,6 +283,8 @@ void bios_linker_loader_add_pointer(BIOSLinker *linker,
const BiosLinkerFileEntry *source_file =
bios_linker_find_file(linker, src_file);
assert(dst_file);
assert(source_file);
assert(dst_patched_offset < dst_file->blob->len);
assert(dst_patched_offset + dst_patched_size <= dst_file->blob->len);
assert(src_offset < source_file->blob->len);