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 arm-uboot, ia64, sparc64: Fix up grub_file_open() calls 2020-09-21 13:46:34 -04:00
aout.c Implement automatic module license checking according to new GNU 2011-04-11 23:01:51 +02:00
linux.c verifiers: Core TPM support 2020-09-21 16:43:54 -04:00
lzss.c Add LZSS Mach-O support (needed for new xnu kernelcache). 2012-02-29 13:26:13 +01:00
macho.c verifiers: File type for fine-grained signature-verification controlling 2020-09-21 13:29:05 -04:00
macho32.c * grub-core/loader/machoXX.c: Fix compilation on non-i386. 2013-12-17 22:44:46 +01:00
macho64.c * grub-core/loader/machoXX.c: Fix compilation on non-i386. 2013-12-17 22:44:46 +01:00
machoXX.c Simplify few strings. 2013-05-07 11:44:15 +02:00
multiboot.c verifiers: Core TPM support 2020-09-21 16:43:54 -04:00
multiboot_elfxx.c multiboot_elfxx.c: Fix compilation by fixing undeclared variable 2020-09-21 13:19:10 -04:00
multiboot_mbi2.c verifiers: Core TPM support 2020-09-21 16:43:54 -04:00
xnu.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
xnu_resume.c verifiers: File type for fine-grained signature-verification controlling 2020-09-21 13:29:05 -04:00