Re: [PATCH 1/1] kernel/kprobes.c: convert printk to pr_foo()

From: Joe Perches
Date: Wed May 07 2014 - 13:54:54 EST


On Tue, 2014-05-06 at 19:12 +0200, Fabian Frederick wrote:

> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
[]
> @@ -1385,7 +1387,7 @@ static struct kprobe * __kprobes __get_valid_kprobe(struct kprobe *p)
> if (p != ap) {
> list_for_each_entry_rcu(list_p, &ap->list, list)
> if (list_p == p)
> - /* kprobe p is a valid probe */
> + /* kprobe p is a valid probe */
> goto valid;
> return NULL;
> }

Perhaps this would be more readable as:

/* Make sure p is a valid probe */
if (p != ap) {
list_for_each_entry_rcu(list_p, &ap->list, list) {
if (list_p == p)
goto valid;
}
return NULL;
}

or maybe the function could be written
without the goto. something like:

static struct kprobe *__get_valid_kprobe(struct kprobe *p)
{
struct kprobe *ap, *list_p;

ap = get_kprobe(p->addr);
if (unlikely(!ap))
return NULL;

if (p == ap)
return ap;

/* Make sure p is a valid probe */
list_for_each_entry_rcu(list_p, &ap->list, list) {
if (list_p == p)
return ap;
}

return NULL;
}


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