From 954ec190896b9630657153760a8d2c176988c933 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 26 May 2025 16:46:45 -0400 Subject: [PATCH] create_inode: fix 32-bit -Werror=pointer-to-int-cast build failure Fixes: 6bfa843b4435 ("mke2fs: enable copying of fs-verity metadata") Signed-off-by: Theodore Ts'o --- configure | 33 +++++++++++++++++++++++++++++++++ configure.ac | 1 + lib/config.h.in | 3 +++ misc/create_inode.c | 4 ++++ 4 files changed, 41 insertions(+) diff --git a/configure b/configure index 4b3a4df7..0ac202d8 100755 --- a/configure +++ b/configure @@ -12765,6 +12765,39 @@ printf "%s\n" "$ac_cv_sizeof_time_t" >&6; } printf "%s\n" "#define SIZEOF_TIME_T $ac_cv_sizeof_time_t" >>confdefs.h +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +printf %s "checking size of void *... " >&6; } +if test ${ac_cv_sizeof_void_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default" +then : + +else $as_nop + if test "$ac_cv_type_void_p" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (void *) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_void_p=0 + fi +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +printf "%s\n" "$ac_cv_sizeof_void_p" >&6; } + + + +printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h + + SIZEOF_SHORT=$ac_cv_sizeof_short SIZEOF_INT=$ac_cv_sizeof_int SIZEOF_LONG=$ac_cv_sizeof_long diff --git a/configure.ac b/configure.ac index 95fd35f3..35b206e7 100644 --- a/configure.ac +++ b/configure.ac @@ -1126,6 +1126,7 @@ AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(time_t) +AC_CHECK_SIZEOF(void *) SIZEOF_SHORT=$ac_cv_sizeof_short SIZEOF_INT=$ac_cv_sizeof_int SIZEOF_LONG=$ac_cv_sizeof_long diff --git a/lib/config.h.in b/lib/config.h.in index a46451f9..480717ab 100644 --- a/lib/config.h.in +++ b/lib/config.h.in @@ -557,6 +557,9 @@ /* The size of `time_t', as computed by sizeof. */ #undef SIZEOF_TIME_T +/* The size of `void *', as computed by sizeof. */ +#undef SIZEOF_VOID_P + /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ diff --git a/misc/create_inode.c b/misc/create_inode.c index e7917b0e..624efc03 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -588,7 +588,11 @@ static errcode_t copy_fs_verity_data(ext2_file_t e2_file, ext2_off_t e2_offset, do { struct fsverity_read_metadata_arg arg = { .metadata_type = metadata_type, +#if (SIZEOF_VOID_P == 4) + .buf_ptr = (uint32_t) buf, +#else .buf_ptr = (uint64_t) buf, +#endif .length = sizeof(buf), .offset = *written, }; -- 2.47.2