zfs: Fix build with GCC on 32-bit architectures

The presence of uint64_t in the expression promotes the entire
expression to uint64_t which is larger than uintptr_t on 32-bit
plaforms.

Note that this also fixes the build for lib32 libraries on 64-bit
platforms.

sys/contrib/openzfs/include/sys/zio.h: In function 'gbh_eck':
sys/contrib/openzfs/include/sys/zio.h:85:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   85 |         return ((zio_eck_t *)((uintptr_t)gbh + size - sizeof (zio_eck_t)));
      |                 ^
This commit is contained in:
John Baldwin
2025-08-07 13:44:24 -04:00
parent ca0d182dfe
commit 2d76470b70
+1 -1
View File
@@ -82,7 +82,7 @@ gbh_nblkptrs(uint64_t size) {
static inline zio_eck_t *
gbh_eck(zio_gbh_phys_t *gbh, uint64_t size) {
ASSERT(IS_P2ALIGNED(size, sizeof (blkptr_t)));
return ((zio_eck_t *)((uintptr_t)gbh + size - sizeof (zio_eck_t)));
return ((zio_eck_t *)((uintptr_t)gbh + (size_t)size - sizeof (zio_eck_t)));
}
static inline blkptr_t *