The name field is not necessarily zero-terminated. Use a precision argument to limit the number of characters written when printing the name.
* 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) { case KMEM_ERR_INVALID: -- 1.8.5.2