Re: [PATCH] selftests: ublk: fix the build and file offsets on 32-bit

From: Ming Lei

Date: Wed Nov 04 2026 - 04:39:13 EST


On Tue, Nov 3, 2026 at 10:39 AM Sasha Levin <sashal@xxxxxxxxxx> wrote:
>
> kublk puts pointers into 64-bit UAPI and SQE fields with a plain (__u64)
> cast. ublk builds with -Werror, so it fails to build on 32-bit
> architectures:
>
> batch.c:379:42: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>
> Cast through uintptr_t. kublk also passes 64-bit user copy offsets,
> which start at UBLKSRV_IO_BUF_OFFSET (2 GB), to pread() and pwrite(),
> and with glibc those are truncated to a 32-bit off_t there. Build with
> -D_FILE_OFFSET_BITS=64 as well.
>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
> Found with 32-bit builds of the selftests (gcc 16 and clang 21 with
> -m32, with and without -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64);
> KernelCI's 32-bit arm builds show the same warnings. The changed files
> build without them now, and the x86_64 builds don't change.
>

Reviewed-by: Ming Lei <tom.leiming@xxxxxxxxx>

Thanks,