[PATCH] test suite: Use %zu to print size_t

Matthew Wilcox willy at infradead.org
Wed Apr 2 15:44:49 PDT 2025


On Thu, Jan 30, 2025 at 11:26:35AM -0500, Liam R. Howlett wrote:
> * Matthew Wilcox (Oracle) <willy at infradead.org> [250130 10:19]:
> > 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 at infradead.org>
> > Fixes: cc86e0c2f306 (radix tree test suite: add support for slab bulk APIs)
> 
> Thanks.  I'll try to remember to do this in the future.

I don't see this in linux-next?

> > ---
> >  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 66dbb362385f..0f97fb0d19e1 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.47.2
> > 



More information about the maple-tree mailing list