[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/8] kern: fix printing of kmem_cache names

From: Justus Winter
Subject: [PATCH 1/8] kern: fix printing of kmem_cache names
Date: Sat, 1 Feb 2014 15:09:21 +0100

The name field is not necessarily zero-terminated.  Use a precision
argument to limit the number of characters written when printing the

* kern/slab.c (kmem_cache_error): Fix printing of cache names.
 kern/slab.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kern/slab.c b/kern/slab.c
index d1e3632..70f2072 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -662,7 +662,8 @@ static void kmem_cache_error(struct kmem_cache *cache, void 
*buf, int error,
     struct kmem_buftag *buftag;
-    kmem_error("cache: %s, buffer: %p", cache->name, (void *)buf);
+    kmem_error("cache: %.*s, buffer: %p", sizeof cache->name, cache->name,
+               (void *)buf);
     switch(error) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]