iommufd/selftest: print size_t with %zu
PATCH 1/1 iommufd/selftest: print size_t with %zu
On 32-bit architectures size_t is an unsigned int, and printing it with %lu warns:
iommufd.c:2157:30: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
Use %zu.
---
Found with a 32-bit build of the selftests with a 64-bit time_t (gcc 16 and clang 21 with -m32 -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64); KernelCI's 32-bit arm builds show the same warnings. The changed files build without format warnings there now, and the x86_64 builds don't change. The other selftests get the same kind of fix in separate patches.
tools/testing/selftests/iommu/iommufd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/iommu/iommufd.c +1 -1
@@ -2154,7 +2154,7 @@ FIXTURE_SETUP(iommufd_dirty_tracking) rc =posix_memalign (&self->buffer,HUGEPAGE_SIZE , mmap_buffer_size);if (rc || !self->buffer) { -SKIP (return,"Skipping buffer_size=%lu due to errno=%d" , +SKIP (return,"Skipping buffer_size=%zu due to errno=%d" , mmap_buffer_size, rc); }assert ((uintptr_t )self->buffer %HUGEPAGE_SIZE ==0 );
Signature · 1 line
2.53.0
Quoted 1 line · Sasha Levin
iommufd/selftest: print
size_twith %zu
Applied, thanks!
[1/1] iommufd/selftest: print size_t with %zu
https://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd.git/commit/?id=f0ff459312183fe1e5ad133db0feeb9faccf908c
Best regards,
Signature · 1 line
Jason