lkml.org 
[lkml]   [2014]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/1] kernel/kprobes.c: convert printk to pr_foo()
From
Date
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;
}




\
 
 \ /
  Last update: 2014-05-07 20:41    [W:0.033 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site