mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	akpm <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/1] kernel/kprobes.c: convert printk to pr_foo()
Date: Wed, 07 May 2014 10:54:46 -0700	[thread overview]
Message-ID: <1399485286.2911.9.camel@joe-AO725> (raw)
In-Reply-To: <20140506191205.49ca307736c06fa89c6b19cc@skynet.be>

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;
}



      reply	other threads:[~2014-05-07 17:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 17:12 Fabian Frederick
2014-05-07 17:54 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399485286.2911.9.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®