[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
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
- [PATCH 1/8] kern: fix printing of kmem_cache names,
Justus Winter <=
- [PATCH 2/8] kern: add snprintf, Justus Winter, 2014/02/01
- [PATCH 4/8] ipc: use the name of the task for error messages, Justus Winter, 2014/02/01
- [PATCH 3/8] kern: add a name field to struct task, Justus Winter, 2014/02/01
- [PATCH 7/8] include: add task_set_name, Justus Winter, 2014/02/01
- [PATCH 5/8] include: add a fixed-size string type for debugging purposes, Justus Winter, 2014/02/01