On 02/16/2017 03:43 AM, Igor Mammedov wrote: >> +++ b/hw/acpi/bios-linker-loader.c >> @@ -78,6 +78,21 @@ struct BiosLinkerLoaderEntry { >> uint32_t length; >> } cksum; >> >> + /* >> + * COMMAND_WRITE_POINTER - write the fw_cfg file (originating from >> + * @dest_file) at @wr_pointer.offset, by adding a pointer to >> + * @src_offset within the table originating from @src_file. >> + * 1,2,4 or 8 byte unsigned addition is used depending on >> + * @wr_pointer.size. >> + */ >> + struct { >> + char dest_file[BIOS_LINKER_LOADER_FILESZ]; >> + char src_file[BIOS_LINKER_LOADER_FILESZ]; >> + uint32_t dst_offset; >> + uint32_t src_offset; >> + uint8_t size; >> + } wr_pointer; >> + >> /* padding */ >> char pad[124]; > Shouldn't padding be reduced by 4 bytes to keep > sizeof(BiosLinkerLoaderEntry) the same as before patch, > so that old bios would be able to skip this unknown command > and read the next at the right offset?
No, because you are in the middle of a union rather than a struct (the outer BiosLinkerLoaderEntry struct size is determined by the largest member of the union, which is 'char pad[124]'; the new wr_pointer addition to the union does not change the size of the union). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature