grub/grub-core/loader
Michael Chang 9093277187 chainloader: Fix gcc9 error -Waddress-of-packed-member
The address of fp->path_name could be unaligned since seeking into the
device path buffer for a given node could end in byte boundary.

The fix is using aligned buffer allocated by grub_malloc for receiving
the converted UTF16 string by grub_utf8_to_utf16 and also the processing
after. The resulting string then gets copied to fp->path_name.

[  243s] ../../grub-core/loader/efi/chainloader.c: In function 'copy_file_path':
[  243s] ../../grub-core/loader/efi/chainloader.c:136:32: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  243s]   136 |   size = grub_utf8_to_utf16 (fp->path_name, len * GRUB_MAX_UTF16_PER_UTF8,
[  243s]       |                              ~~^~~~~~~~~~~
[  243s] ../../grub-core/loader/efi/chainloader.c:138:12: error: taking address of packed member of 'struct grub_efi_file_path_device_path' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  243s]   138 |   for (p = fp->path_name; p < fp->path_name + size; p++)
[  243s]       |            ^~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 20:05:48 -04:00
..
arm arm: Move initrd upper to leave more space for kernel 2020-09-21 16:43:54 -04:00
arm64 efi: Rename armxx to arch 2020-09-21 16:43:54 -04:00
efi chainloader: Fix gcc9 error -Waddress-of-packed-member 2020-09-21 20:05:48 -04:00
i386 Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
ia64/efi verifiers: IA-64 fallout cleanup 2020-09-21 19:37:19 -04:00
mips verifiers: MIPS fallout cleanup 2020-09-21 19:37:19 -04:00
powerpc/ieee1275 verifiers: PowerPC fallout cleanup 2020-09-21 19:37:19 -04:00
riscv RISC-V: Add Linux load logic 2020-09-21 16:43:54 -04:00
sparc64/ieee1275
aout.c
linux.c
lzss.c
macho.c
macho32.c
macho64.c
machoXX.c
multiboot.c
multiboot_elfxx.c
multiboot_mbi2.c
xnu.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
xnu_resume.c