diff options
| author | Liming Wang <liming.wang@windriver.com> | 2008-12-04 01:24:49 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-12-04 03:42:35 -0500 |
| commit | faec2ec505d397e9426754722b6e80d519c4938f (patch) | |
| tree | 574d290807a5bdf1bb41325ce6855aecf872e1b5 /kernel/trace | |
| parent | 6b2539302bee8e88c99e3c7d80c16a04dbe5e2ad (diff) | |
ftrace: avoid duplicated function when writing set_graph_function
Impact: fix a bug in function filter setting
when writing function to set_graph_function, we should check whether it
has existed in set_graph_function to avoid duplicating.
Signed-off-by: Liming Wang <liming.wang@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/ftrace.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index eb57dc1ea097..d2b156538162 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1425,7 +1425,7 @@ ftrace_set_func(unsigned long *array, int idx, char *buffer) | |||
| 1425 | struct dyn_ftrace *rec; | 1425 | struct dyn_ftrace *rec; |
| 1426 | struct ftrace_page *pg; | 1426 | struct ftrace_page *pg; |
| 1427 | int found = 0; | 1427 | int found = 0; |
| 1428 | int i; | 1428 | int i, j; |
| 1429 | 1429 | ||
| 1430 | if (ftrace_disabled) | 1430 | if (ftrace_disabled) |
| 1431 | return -ENODEV; | 1431 | return -ENODEV; |
| @@ -1443,7 +1443,13 @@ ftrace_set_func(unsigned long *array, int idx, char *buffer) | |||
| 1443 | kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); | 1443 | kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); |
| 1444 | if (strcmp(str, buffer) == 0) { | 1444 | if (strcmp(str, buffer) == 0) { |
| 1445 | found = 1; | 1445 | found = 1; |
| 1446 | array[idx] = rec->ip; | 1446 | for (j = 0; j < idx; j++) |
| 1447 | if (array[j] == rec->ip) { | ||
| 1448 | found = 0; | ||
| 1449 | break; | ||
| 1450 | } | ||
| 1451 | if (found) | ||
| 1452 | array[idx] = rec->ip; | ||
| 1447 | break; | 1453 | break; |
| 1448 | } | 1454 | } |
| 1449 | } | 1455 | } |
