]> git.ipfire.org Git - thirdparty/grub.git/commit
osdep/devmapper/getroot: Fix build error on 32-bit host
authorMichael Chang <mchang@suse.com>
Wed, 1 Mar 2023 09:23:08 +0000 (17:23 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 7 Mar 2023 14:47:42 +0000 (15:47 +0100)
commit88478417315b652850e36ff7f3f63f6bcf399e84
tree40401bc12c3223a498ad648e095345c16f1c56b3
parent9e78ab2b0f277dfd31012ad9df1bb6ba492b4cae
osdep/devmapper/getroot: Fix build error on 32-bit host

The gcc build has failed for 32-bit host (e.g. i386-emu and arm-emu)
due to mismatch between format specifier and data type.

../grub-core/osdep/devmapper/getroot.c: In function
'grub_util_pull_devmapper':

../grub-core/osdep/devmapper/getroot.c:265:75: error: format '%lu'
expects argument of type 'long unsigned int', but argument 2 has type
'int' [-Werror=format=]

../grub-core/osdep/devmapper/getroot.c:276:80: error: format '%lu'
expects argument of type 'long unsigned int', but argument 2 has type
'int' [-Werror=format=]

This patch fixes the problem by casting the type of calculated offset to
grub_size_t and use platform PRIuGRUB_SIZE as format specifier.

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/osdep/devmapper/getroot.c