mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests: dmabuf-heaps: print size_t with %zu
@ 2026-11-03 15:54 Sasha Levin
  2026-11-03 16:24 ` T.J. Mercier
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-11-03 15:54 UTC (permalink / raw)
  To: Sumit Semwal
  Cc: Benjamin Gaignard, Brian Starkey, John Stultz, T.J. Mercier,
	Shuah Khan, linux-media, dri-devel, linaro-mm-sig,
	linux-kselftest, linux-kernel

On 32-bit architectures size_t is an unsigned int, and printing it with
%ld warns:

  dmabuf-heap.c:215:43: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Wformat=]

Use %zu.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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/dmabuf-heaps/dmabuf-heap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
index 1d49df6719198..c65efc088e88d 100644
--- a/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
+++ b/tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
@@ -212,7 +212,7 @@ static void test_alloc_zeroed(char *heap_name, size_t size)
 	void *p = NULL;
 	char *c;
 
-	ksft_print_msg("Testing alloced %ldk buffers are zeroed:\n", size / 1024);
+	ksft_print_msg("Testing alloced %zuk buffers are zeroed:\n", size / 1024);
 	heap_fd = dmabuf_heap_open(heap_name);
 
 	/* Allocate and fill a bunch of buffers */
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests: dmabuf-heaps: print size_t with %zu
  2026-11-03 15:54 [PATCH] selftests: dmabuf-heaps: print size_t with %zu Sasha Levin
@ 2026-11-03 16:24 ` T.J. Mercier
  0 siblings, 0 replies; 2+ messages in thread
From: T.J. Mercier @ 2026-11-03 16:24 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Sumit Semwal, Benjamin Gaignard, Brian Starkey, John Stultz,
	Shuah Khan, linux-media, dri-devel, linaro-mm-sig,
	linux-kselftest, linux-kernel

On Tue, Nov 3, 2026 at 7:55 AM Sasha Levin <sashal@kernel.org> wrote:
>
> On 32-bit architectures size_t is an unsigned int, and printing it with
> %ld warns:
>
>   dmabuf-heap.c:215:43: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
>
> Use %zu.
>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

Reviewed-by: T.J. Mercier <tjmercier@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 15:54 [PATCH] selftests: dmabuf-heaps: print size_t with %zu Sasha Levin
2026-11-03 16:24 ` T.J. Mercier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®