grub/grub-core/fs
Michael Chang b0f3e50964 hfsplus: Fix gcc9 error with -Waddress-of-packed-member
The catkey->name could be unaligned since the address of 'void* record'
is calculated as offset in bytes to a malloc buffer.

The fix is using aligned buffer allocated by grub_malloc for holding
the UTF16 string copied from catkey->name. And use that buffer as
argument for grub_utf16_to_utf8 to convert to UTF8 strings.

In addition, using a new copy of buffer rather than catkey->name itself
for processing the endianess conversion, we can also get rid of the hunk
restoring byte order of catkey->name to what it was previously.

[   59s] ../grub-core/fs/hfsplus.c: In function 'list_nodes':
[   59s] ../grub-core/fs/hfsplus.c:738:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]   738 |   *grub_utf16_to_utf8 ((grub_uint8_t *) filename, catkey->name,
[   59s]       |                                                   ~~~~~~^~~~~~
[   59s] ../grub-core/fs/hfsplus.c: In function 'grub_hfsplus_label':
[   59s] ../grub-core/fs/hfsplus.c:1019:57: error: taking address of packed member of 'struct grub_hfsplus_catkey' may result in an unaligned pointer value [-Werror=address-of-packed-member]
[   59s]  1019 |   *grub_utf16_to_utf8 ((grub_uint8_t *) (*label), catkey->name,
[   59s]       |                                                   ~~~~~~^~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 20:05:48 -04:00
..
zfs Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
affs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
afs.c Leverage BFS implementation to read AFS. 2011-10-30 16:10:18 +01:00
archelp.c archelp: Never pass NULL as mtime. 2015-07-27 13:19:02 +02:00
bfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
btrfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
cbfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
cpio.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
cpio_be.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
cpio_common.c cpio: Disable gcc9 -Waddress-of-packed-member 2020-09-21 20:05:48 -04:00
exfat.c exfat reader 2011-04-11 18:13:00 +02:00
ext2.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
f2fs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
fat.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
fshelp.c fshelp: Add handling of "." and ".." and grub_fshelp_find_file_lookup. 2015-07-27 12:45:35 +02:00
hfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
hfsplus.c hfsplus: Fix gcc9 error with -Waddress-of-packed-member 2020-09-21 20:05:48 -04:00
hfspluscomp.c Make grub_zlib_decompress handle incomplete chunks. 2013-12-18 23:39:49 +01:00
iso9660.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
jfs.c jfs: Disable gcc9 -Waddress-of-packed-member 2020-09-21 20:05:48 -04:00
minix.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
minix2.c Split minix.mod into minix.mod and minix2.mod. 2010-09-08 19:13:48 +02:00
minix2_be.c Handle big-endian minixfs (fixes minixfs tests on bigendian). 2012-04-01 21:35:18 +02:00
minix3.c minix3fs support 2011-04-11 08:16:13 +02:00
minix3_be.c Handle big-endian minixfs (fixes minixfs tests on bigendian). 2012-04-01 21:35:18 +02:00
minix_be.c Handle big-endian minixfs (fixes minixfs tests on bigendian). 2012-04-01 21:35:18 +02:00
newc.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
nilfs2.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
ntfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
ntfscomp.c Fix warnings when compiling with -O3 2016-02-17 17:56:41 +01:00
odc.c Add gcc_struct to all packed structures when compiling with mingw. 2013-12-15 14:14:30 +01:00
proc.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
reiserfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
romfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
sfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
squash4.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
tar.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
udf.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
ufs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00
ufs2.c automake commit without merge history 2010-05-06 11:34:04 +05:30
ufs_be.c Support big-endian UFS1. 2012-12-08 20:56:58 +01:00
xfs.c Change fs functions to add fs_ prefix 2020-09-21 20:05:48 -04:00