trace: strlen() return doesn't account for the NULL
authorDan Carpenter <error27@gmail.com>
Sat, 10 Jul 2010 10:06:44 +0000 (12:06 +0200)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 22 Jul 2010 18:56:41 +0000 (14:56 -0400)
We need to add one to the strlen() return because of the NULL
character.  The type->name here generally comes from the kernel and I
don't think any of them come close to being MAX_TRACER_SIZE (100)
characters long so this is basically a cleanup.

Signed-off-by: Dan Carpenter <error27@gmail.com>
LKML-Reference: <20100710100644.GV19184@bicker>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index f7488f44d26babd796d8b0fd5079d4eaeb8206a5..cacb6f083ecb94498efefcd20d86d6632397ae0f 100644 (file)
@@ -739,7 +739,7 @@ __acquires(kernel_lock)
                return -1;
        }
 
-       if (strlen(type->name) > MAX_TRACER_SIZE) {
+       if (strlen(type->name) >= MAX_TRACER_SIZE) {
                pr_info("Tracer has a name longer than %d\n", MAX_TRACER_SIZE);
                return -1;
        }