* [PATCH] mm: slub: fix format mismatches in slab_err() callers
@ 2014-11-05 15:12 Andrey Ryabinin
2014-11-05 16:51 ` Christoph Lameter
2014-11-05 21:48 ` David Rientjes
0 siblings, 2 replies; 5+ messages in thread
From: Andrey Ryabinin @ 2014-11-05 15:12 UTC (permalink / raw)
To: akpm
Cc: linux-mm, linux-kernel, Andrey Ryabinin, Christoph Lameter,
Pekka Enberg, David Rientjes, Joonsoo Kim
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);
Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
mm/slub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 80c170e..850a94a 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -849,12 +849,12 @@ static int check_slab(struct kmem_cache *s, struct page *page)
maxobj = order_objects(compound_order(page), s->size, s->reserved);
if (page->objects > maxobj) {
slab_err(s, page, "objects %u > max %u",
- s->name, page->objects, maxobj);
+ page->objects, maxobj);
return 0;
}
if (page->inuse > page->objects) {
slab_err(s, page, "inuse %u > max %u",
- s->name, page->inuse, page->objects);
+ page->inuse, page->objects);
return 0;
}
/* Slab_pad_check fixes things up after itself */
@@ -902,7 +902,7 @@ static int on_freelist(struct kmem_cache *s, struct page *page, void *search)
if (page->objects != max_objects) {
slab_err(s, page, "Wrong number of objects. Found %d but "
- "should be %d", page->objects, max_objects);
+ "should be %ld", page->objects, max_objects);
page->objects = max_objects;
slab_fix(s, "Number of objects adjusted.");
}
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: slub: fix format mismatches in slab_err() callers
2014-11-05 15:12 [PATCH] mm: slub: fix format mismatches in slab_err() callers Andrey Ryabinin
@ 2014-11-05 16:51 ` Christoph Lameter
2014-11-05 21:48 ` David Rientjes
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Lameter @ 2014-11-05 16:51 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: akpm, linux-mm, linux-kernel, Pekka Enberg, David Rientjes, Joonsoo Kim
On Wed, 5 Nov 2014, Andrey Ryabinin wrote:
> Adding __printf(3, 4) to slab_err exposed following:
Acked-by: Christoph Lameter <cl@linux.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm: slub: fix format mismatches in slab_err() callers
2014-11-05 15:12 [PATCH] mm: slub: fix format mismatches in slab_err() callers Andrey Ryabinin
2014-11-05 16:51 ` Christoph Lameter
@ 2014-11-05 21:48 ` David Rientjes
2014-11-06 8:16 ` [PATCH v2] " Andrey Ryabinin
1 sibling, 1 reply; 5+ messages in thread
From: David Rientjes @ 2014-11-05 21:48 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: akpm, linux-mm, linux-kernel, Christoph Lameter, Pekka Enberg,
Joonsoo Kim
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2570 bytes --]
On Wed, 5 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]
>
Wow, that's an ancient issue, thanks for finding it.
> 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);
>
> Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
> mm/slub.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 80c170e..850a94a 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -849,12 +849,12 @@ static int check_slab(struct kmem_cache *s, struct page *page)
> maxobj = order_objects(compound_order(page), s->size, s->reserved);
> if (page->objects > maxobj) {
> slab_err(s, page, "objects %u > max %u",
> - s->name, page->objects, maxobj);
> + page->objects, maxobj);
> return 0;
> }
> if (page->inuse > page->objects) {
> slab_err(s, page, "inuse %u > max %u",
> - s->name, page->inuse, page->objects);
> + page->inuse, page->objects);
> return 0;
> }
> /* Slab_pad_check fixes things up after itself */
> @@ -902,7 +902,7 @@ static int on_freelist(struct kmem_cache *s, struct page *page, void *search)
>
> if (page->objects != max_objects) {
> slab_err(s, page, "Wrong number of objects. Found %d but "
> - "should be %d", page->objects, max_objects);
> + "should be %ld", page->objects, max_objects);
> page->objects = max_objects;
> slab_fix(s, "Number of objects adjusted.");
> }
Instead of this hunk, I think that max_objects should be declared as int
rather than unsigned long since that's what order_objects() returns and it
is being compared to page->objects which is also int.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] mm: slub: fix format mismatches in slab_err() callers
2014-11-05 21:48 ` David Rientjes
@ 2014-11-06 8:16 ` Andrey Ryabinin
2014-11-06 21:59 ` David Rientjes
0 siblings, 1 reply; 5+ messages in thread
From: Andrey Ryabinin @ 2014-11-06 8:16 UTC (permalink / raw)
To: akpm
Cc: linux-mm, linux-kernel, Andrey Ryabinin, Christoph Lameter,
Pekka Enberg, David Rientjes, Joonsoo Kim
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@samsung.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
Changes since v1:
- To fix the last warning change the type of max_objects instead of changing format string (David)
- Slightly update changelog
mm/slub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 80c170e..ed816f8 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -849,12 +849,12 @@ static int check_slab(struct kmem_cache *s, struct page *page)
maxobj = order_objects(compound_order(page), s->size, s->reserved);
if (page->objects > maxobj) {
slab_err(s, page, "objects %u > max %u",
- s->name, page->objects, maxobj);
+ page->objects, maxobj);
return 0;
}
if (page->inuse > page->objects) {
slab_err(s, page, "inuse %u > max %u",
- s->name, page->inuse, page->objects);
+ page->inuse, page->objects);
return 0;
}
/* Slab_pad_check fixes things up after itself */
@@ -871,7 +871,7 @@ static int on_freelist(struct kmem_cache *s, struct page *page, void *search)
int nr = 0;
void *fp;
void *object = NULL;
- unsigned long max_objects;
+ int max_objects;
fp = page->freelist;
while (fp && nr <= page->objects) {
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] mm: slub: fix format mismatches in slab_err() callers
2014-11-06 8:16 ` [PATCH v2] " Andrey Ryabinin
@ 2014-11-06 21:59 ` David Rientjes
0 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2014-11-06 21:59 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: akpm, linux-mm, linux-kernel, Christoph Lameter, Pekka Enberg,
Joonsoo Kim
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1335 bytes --]
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@samsung.com>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: David Rientjes <rientjes@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-06 21:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 15:12 [PATCH] mm: slub: fix format mismatches in slab_err() callers Andrey Ryabinin
2014-11-05 16:51 ` Christoph Lameter
2014-11-05 21:48 ` David Rientjes
2014-11-06 8:16 ` [PATCH v2] " Andrey Ryabinin
2014-11-06 21:59 ` David Rientjes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).