diff mbox series

test suite: Use %zu to print size_t

Message ID 20250403003311.359917-1-Liam.Howlett@oracle.com (mailing list archive)
State New
Headers show
Series test suite: Use %zu to print size_t | expand

Commit Message

Liam R. Howlett April 3, 2025, 12:33 a.m. UTC
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

On 32-bit, we can't use %lu to print a size_t variable and gcc warns us
about it.  Shame it doesn't warn about it on 64-bit.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Fixes: cc86e0c2f306 (radix tree test suite: add support for slab bulk APIs)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---

Note that this requires the patch to fix the headers [1] for the testing
to build.  Unfortunately, that has not landed, but the patches do not
conflict so we should push this upstream anyways.

[1].  https://lore.kernel.org/all/20250321-fix-radix-tree-build-v1-1-838a1e6540e2@samsung.com/

 tools/testing/shared/linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Liam R. Howlett April 3, 2025, 2:53 a.m. UTC | #1
* Liam R. Howlett <Liam.Howlett@oracle.com> [250402 20:33]:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> On 32-bit, we can't use %lu to print a size_t variable and gcc warns us
> about it.  Shame it doesn't warn about it on 64-bit.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Fixes: cc86e0c2f306 (radix tree test suite: add support for slab bulk APIs)
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
> 
> Note that this requires the patch to fix the headers [1] for the testing
> to build.  Unfortunately, that has not landed, but the patches do not
> conflict so we should push this upstream anyways.
> 
> [1].  https://lore.kernel.org/all/20250321-fix-radix-tree-build-v1-1-838a1e6540e2@samsung.com/

Sorry, This should not have been 'in-reply-to' the previous older patch
set.  Let me know if you want me to resend.

Thanks,
Liam

> 
>  tools/testing/shared/linux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/shared/linux.c b/tools/testing/shared/linux.c
> index 66dbb362385f3..0f97fb0d19e19 100644
> --- a/tools/testing/shared/linux.c
> +++ b/tools/testing/shared/linux.c
> @@ -150,7 +150,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
>  void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list)
>  {
>  	if (kmalloc_verbose)
> -		pr_debug("Bulk free %p[0-%lu]\n", list, size - 1);
> +		pr_debug("Bulk free %p[0-%zu]\n", list, size - 1);
>  
>  	pthread_mutex_lock(&cachep->lock);
>  	for (int i = 0; i < size; i++)
> @@ -168,7 +168,7 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
>  	size_t i;
>  
>  	if (kmalloc_verbose)
> -		pr_debug("Bulk alloc %lu\n", size);
> +		pr_debug("Bulk alloc %zu\n", size);
>  
>  	pthread_mutex_lock(&cachep->lock);
>  	if (cachep->nr_objs >= size) {
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/tools/testing/shared/linux.c b/tools/testing/shared/linux.c
index 66dbb362385f3..0f97fb0d19e19 100644
--- a/tools/testing/shared/linux.c
+++ b/tools/testing/shared/linux.c
@@ -150,7 +150,7 @@  void kmem_cache_free(struct kmem_cache *cachep, void *objp)
 void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list)
 {
 	if (kmalloc_verbose)
-		pr_debug("Bulk free %p[0-%lu]\n", list, size - 1);
+		pr_debug("Bulk free %p[0-%zu]\n", list, size - 1);
 
 	pthread_mutex_lock(&cachep->lock);
 	for (int i = 0; i < size; i++)
@@ -168,7 +168,7 @@  int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
 	size_t i;
 
 	if (kmalloc_verbose)
-		pr_debug("Bulk alloc %lu\n", size);
+		pr_debug("Bulk alloc %zu\n", size);
 
 	pthread_mutex_lock(&cachep->lock);
 	if (cachep->nr_objs >= size) {