Re: [PATCH v2] mm: slub: fix format mismatches in slab_err() callers

From: David Rientjes
Date: Thu Nov 06 2014 - 16:59:30 EST


On Thu, 6 Nov 2014, Andrey Ryabinin wrote:

> Adding __printf(3, 4) to slab_err exposed following:
>
> mm/slub.c: In function âcheck_slabâ:
> mm/slub.c:852:4: warning: format â%uâ expects argument of type âunsigned intâ, but argument 4 has type âconst char *â [-Wformat=]
> s->name, page->objects, maxobj);
> ^
> mm/slub.c:852:4: warning: too many arguments for format [-Wformat-extra-args]
> mm/slub.c:857:4: warning: format â%uâ expects argument of type âunsigned intâ, but argument 4 has type âconst char *â [-Wformat=]
> s->name, page->inuse, page->objects);
> ^
> mm/slub.c:857:4: warning: too many arguments for format [-Wformat-extra-args]
>
> mm/slub.c: In function âon_freelistâ:
> mm/slub.c:905:4: warning: format â%dâ expects argument of type âintâ, but argument 5 has type âlong unsigned intâ [-Wformat=]
> "should be %d", page->objects, max_objects);
>
> Fix first two warnings by removing redundant s->name.
> Fix the last by changing type of max_object from unsigned long to int.
>
> Signed-off-by: Andrey Ryabinin <a.ryabinin@xxxxxxxxxxx>
> Cc: Christoph Lameter <cl@xxxxxxxxx>
> Cc: Pekka Enberg <penberg@xxxxxxxxxx>
> Cc: David Rientjes <rientjes@xxxxxxxxxx>
> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>

Acked-by: David Rientjes <rientjes@xxxxxxxxxx>