[syslinux] [PATCH 1/4] efi: Fix PE header field rva_and_sizes_nr

Matt Fleming matt at console-pimps.org
Fri Nov 29 04:18:53 PST 2013


On Wed, 27 Nov, at 02:38:28PM, Celelibi wrote:
> The value of the field rva_and_sizes_nr is used by OVMF to check the
> consistency of the PE file with respect to the field optional_hdr_sz. It
> now have the right value.
> 
> Signed-off-by: Celelibi <celelibi at gmail.com>
> ---
>  efi/wrapper.c |  6 +++---
>  efi/wrapper.h | 28 ++++++++++++++++------------
>  2 files changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/efi/wrapper.c b/efi/wrapper.c
> index 04c895f..ec77271 100644
> --- a/efi/wrapper.c
> +++ b/efi/wrapper.c
> @@ -102,7 +102,7 @@ static void write_header(FILE *f, __uint32_t entry, size_t data_size,
>  		e_hdr.image_sz = total_sz;
>  		e_hdr.headers_sz = 512;
>  		e_hdr.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
> -		e_hdr.rva_and_sizes_nr = 1;
> +		e_hdr.rva_and_sizes_nr = sizeof(e_hdr.data_directory) / sizeof(__uint64_t);


Since the data directories aren't ever used, can't we just delete them
and set rva_and_sizes_nr to 0?

-- 
Matt Fleming, Intel Open Source Technology Center


More information about the Syslinux mailing list