Re: [PATCH -tip v2 3/3] kprobes: Set IPMODIFY flag only if the probe can change regs->ip

From: Namhyung Kim
Date: Thu Jun 19 2014 - 20:09:35 EST


On Thu, 19 Jun 2014 21:34:31 +0900, Namhyung Kim wrote:
> What about this?
>
> static int __ftrace_remove_filter_ip(...)
> {
> if (*ref == 1) {
> int ret = unregister_ftrace_function(ops);
> if (ret < 0)
> return ret;
>
> ftrace_set_filter_ip(ops, ip, 1, 0);
> }
>
> (*ref)--;
> return 0;
> }


Hmm.. I missed removing in *ref > 1 case. Here's a v2. :)


static int __ftrace_remove_filter_ip(...)
{
int ret;

if (*ref == 1) {
ret = unregister_ftrace_function(ops);
if (ret < 0)
return ret;

/* ignore failure here */
ftrace_set_filter_ip(ops, ip, 1, 0);
} else
ret = ftrace_set_filter_ip(ops, ip, 1, 0);
if (ret < 0)
return ret;
}

(*ref)--;
return 0;
}

--
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/