Re: [RFC 2/4] perf, ftrace: Add filter support for ftrace:functiontracepoint

From: Steven Rostedt
Date: Wed Aug 10 2011 - 15:34:20 EST


Hi Jiri,

Sorry for the late response, I've been catching up on lots of other
things.


On Mon, 2011-07-11 at 15:22 +0200, Jiri Olsa wrote:

> +int ftrace_function_rec_ip(char *func, unsigned long long *ip)
> +{
> + struct ftrace_page *pg;
> + struct dyn_ftrace *rec;
> + int len = strlen(func);
> + int found = 0;
> +
> + mutex_lock(&ftrace_lock);
> +
> + do_for_each_ftrace_rec(pg, rec) {
> + if (!ftrace_match_record(rec, NULL, func, len, MATCH_FULL))
> + continue;
> +
> + *ip = rec->ip;
> + found = 1;
> + break;

You can't use break here. The do_for_each_ftrace_rec() { }
while_for_each_ftrace_rec(); is a double loop. The break exits the first
loop, but then continues to the next loop. You must use a goto.

-- Steve

> + } while_for_each_ftrace_rec();
> +
> + mutex_unlock(&ftrace_lock);
> +
> + return found ? 0 : -EINVAL;
> +}
> +


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/