[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] acpi: verify file entries in bios_linker_loader
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [PATCH] acpi: verify file entries in bios_linker_loader_add_pointer() |
Date: |
Fri, 22 Mar 2019 13:17:43 +0100 |
On Thu, 21 Mar 2019 20:13:49 +0000
Liam Merwick <address@hidden> wrote:
> 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 <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
> ---
> hw/acpi/bios-linker-loader.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/acpi/bios-linker-loader.c b/hw/acpi/bios-linker-loader.c
> index d16b8bbcb187..626c04a39f92 100644
> --- a/hw/acpi/bios-linker-loader.c
> +++ b/hw/acpi/bios-linker-loader.c
> @@ -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);