trace: use kbasename()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 18 Dec 2012 00:01:27 +0000 (16:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 18 Dec 2012 01:15:17 +0000 (17:15 -0800)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/trace/trace_uprobe.c

index 9614db8b0f8cc67935dbf5beab379dbae74197a7..c86e6d4f67fbfac4a81c6c58d7194afa7603f7e5 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/uaccess.h>
 #include <linux/uprobes.h>
 #include <linux/namei.h>
+#include <linux/string.h>
 
 #include "trace_probe.h"
 
@@ -263,16 +264,15 @@ static int create_trace_uprobe(int argc, char **argv)
 
        /* setup a probe */
        if (!event) {
-               char *tail = strrchr(filename, '/');
+               char *tail;
                char *ptr;
 
-               ptr = kstrdup((tail ? tail + 1 : filename), GFP_KERNEL);
-               if (!ptr) {
+               tail = kstrdup(kbasename(filename), GFP_KERNEL);
+               if (!tail) {
                        ret = -ENOMEM;
                        goto fail_address_parse;
                }
 
-               tail = ptr;
                ptr = strpbrk(tail, ".-_");
                if (ptr)
                        *ptr = '\0';