On Tue, Oct 21, 2014 at 05:48:30PM +0200, Jiri Kosina wrote:

>  kernel/kprobes.c        | 28 ++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
> index f7296e5..f760555 100644
> --- a/include/linux/kprobes.h
> +++ b/include/linux/kprobes.h
> @@ -384,6 +384,7 @@ int disable_kprobe(struct kprobe *kp);
>  int enable_kprobe(struct kprobe *kp);
> 
>  void dump_kprobe(struct kprobe *kp);
> +bool kprobe_is_function_probed(const char *name);

Better name? function_is_kprobed() or such?

...

> +bool kprobe_is_function_probed(const char *name)
> +{
> +     struct hlist_head *head;
> +     struct kprobe *p, *kp;

kp not used

> +     const char *sym = NULL;
> +     unsigned long offset = 0;
> +     unsigned int i;
> +     char *modname, namebuf[KSYM_NAME_LEN];
> +
> +     preempt_disable();
> +     for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
> +             head = &kprobe_table[i];
> +             hlist_for_each_entry_rcu(p, head, hlist) {
> +                     sym = kallsyms_lookup((unsigned long)p->addr,
> +                                     NULL, &offset, &modname,
> +                                     namebuf);
> +                     if (!strcmp(sym, name))

Don't you want a strncmp instead?

Ananth

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

Reply via email to