Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit faec2ec5 authored by Liming Wang's avatar Liming Wang Committed by Ingo Molnar
Browse files

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: default avatarLiming Wang <liming.wang@windriver.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6b253930
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -1425,7 +1425,7 @@ ftrace_set_func(unsigned long *array, int idx, char *buffer)
	struct dyn_ftrace *rec;
	struct dyn_ftrace *rec;
	struct ftrace_page *pg;
	struct ftrace_page *pg;
	int found = 0;
	int found = 0;
	int i;
	int i, j;


	if (ftrace_disabled)
	if (ftrace_disabled)
		return -ENODEV;
		return -ENODEV;
@@ -1443,6 +1443,12 @@ ftrace_set_func(unsigned long *array, int idx, char *buffer)
			kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
			kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
			if (strcmp(str, buffer) == 0) {
			if (strcmp(str, buffer) == 0) {
				found = 1;
				found = 1;
				for (j = 0; j < idx; j++)
					if (array[j] == rec->ip) {
						found = 0;
						break;
					}
				if (found)
					array[idx] = rec->ip;
					array[idx] = rec->ip;
				break;
				break;
			}
			}