Re: [PATCH v5 1/9] ftrace: Add ftrace_set_filter_ips function

Jiri Olsa
2022-01-28T09:38:06Z

On Fri, Jan 28, 2022 at 11:05:23AM +0900, Masami Hiramatsu wrote:

SNIP

>
> So, I wrote a below change for the next version. Is that OK for you?
>
> Thank you,
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index f305e18f699f..a28b1bdb234a 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -4985,8 +4985,13 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long *ips,
>
> for (i = 0; i < cnt; i++) {
> err = __ftrace_match_addr(hash, ips[i], remove);
> - if (err)
> + if (err) {
> + /*
> + * This expects the @hash is a temporary hash and if this
> + * fails the caller must free the @hash.
> + */
> return err;
> + }
> }
> return 0;
> }
> @@ -5649,7 +5654,7 @@ int ftrace_set_filter_ip(struct ftrace_ops *ops, unsigned long ip,
> EXPORT_SYMBOL_GPL(ftrace_set_filter_ip);
>
> /**
> - * ftrace_set_filter_ips - set a functions to filter on in ftrace by addresses
> + * ftrace_set_filter_ips - set functions to filter on in ftrace by addresses
> * @ops - the ops to set the filter with
> * @ips - the array of addresses to add to or remove from the filter.
> * @cnt - the number of addresses in @ips

looks good, thanks

jirka