Change the le_to_cpu16_copy function to use void* type as its second argument to silence the warning. The pointer is later type casted to grub_uint16_t* and use grub_get_unaligned16 for safely deferencing it for the value.
The solved gcc9 error like this. [ 60s] ../grub-core/fs/jfs.c: In function 'grub_jfs_getent': [ 60s] ../grub-core/fs/jfs.c:557:44: error: taking address of packed member of 'struct grub_jfs_leaf_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] [ 60s] 557 | le_to_cpu16_copy (filename + strpos, leaf->namepart, len < diro->data->namecomponentlen ? len [ 60s] | ~~~~^~~~~~~~~~ [ 60s] ../grub-core/fs/jfs.c:570:48: error: taking address of packed member of 'struct grub_jfs_leaf_next_dirent' may result in an unaligned pointer value [-Werror=address-of-packed-member] [ 60s] 570 | le_to_cpu16_copy (filename + strpos, next_leaf->namepart, len < 15 ? len : 15); [ 60s] | ~~~~~~~~~^~~~~~~~~~ [ 60s] cc1: all warnings being treated as errors Signed-off-by: Michael Chang <mch...@suse.com> --- grub-core/fs/jfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c index 09bc5608d..f1fe72192 100644 --- a/grub-core/fs/jfs.c +++ b/grub-core/fs/jfs.c @@ -499,10 +499,11 @@ grub_jfs_closedir (struct grub_jfs_diropen *diro) } static void -le_to_cpu16_copy (grub_uint16_t *out, grub_uint16_t *in, grub_size_t len) +le_to_cpu16_copy (grub_uint16_t *out, const void *in, grub_size_t len) { + const grub_uint16_t *p = (const grub_uint16_t *)in; while (len--) - *out++ = grub_le_to_cpu16 (*in++); + *out++ = grub_le_to_cpu16 (grub_get_unaligned16 (p++)); } -- 2.16.4 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel