Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / kernel / trace / trace_kprobe.c
index 2ec1a38..367b365 100644 (file)
@@ -920,7 +920,7 @@ static struct notifier_block trace_probe_module_nb = {
 };
 
 /* Split symbol and offset. */
-static int split_symbol_offset(char *symbol, unsigned long *offset)
+static int split_symbol_offset(char *symbol, long *offset)
 {
        char *tmp;
        int ret;
@@ -928,10 +928,9 @@ static int split_symbol_offset(char *symbol, unsigned long *offset)
        if (!offset)
                return -EINVAL;
 
-       tmp = strchr(symbol, '+');
+       tmp = strpbrk(symbol, "+-");
        if (tmp) {
-               /* skip sign because strict_strtol doesn't accept '+' */
-               ret = strict_strtoul(tmp + 1, 0, offset);
+               ret = kstrtol(tmp, 0, offset);
                if (ret)
                        return ret;
                *tmp = '\0';
@@ -1165,7 +1164,7 @@ static int create_trace_probe(int argc, char **argv)
        int is_return = 0, is_delete = 0;
        char *symbol = NULL, *event = NULL, *group = NULL;
        char *arg;
-       unsigned long offset = 0;
+       long offset = 0;
        void *addr = NULL;
        char buf[MAX_EVENT_NAME_LEN];
 
@@ -1238,7 +1237,7 @@ static int create_trace_probe(int argc, char **argv)
                symbol = argv[1];
                /* TODO: support .init module functions */
                ret = split_symbol_offset(symbol, &offset);
-               if (ret) {
+               if (ret || offset < 0 || offset > UINT_MAX) {
                        pr_info("Failed to parse either an address or a symbol.\n");
                        return ret;
                }