public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Josh Triplett <josh@freedesktop.org>,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3 v2] kernel/rcutorture.c: Move call to PTR_ERR after reassignment
Date: Thu, 2 Feb 2012 07:53:38 -0800	[thread overview]
Message-ID: <20120202155338.GF2518@linux.vnet.ibm.com> (raw)
In-Reply-To: <1328194382-32465-4-git-send-email-Julia.Lawall@lip6.fr>

Queued, thank you both!

							Thanx, Paul

On Thu, Feb 02, 2012 at 03:53:02PM +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> PTR_ERR should be called before its argument is cleared.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e,e1;
> constant c;
> @@
> 
> *e = c
> ... when != e = e1
>     when != &e
>     when != true IS_ERR(e)
> *PTR_ERR(e)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Reported-by: Josh Triplett <josh@joshtriplett.org>
> 
> ---
> v2: correct commit message.
> 
>  kernel/rcutorture.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
> index a58ac28..4b3cd87 100644
> --- a/kernel/rcutorture.c
> +++ b/kernel/rcutorture.c
> @@ -1450,12 +1450,15 @@ rcu_torture_onoff(void *arg)
>  static int __cpuinit
>  rcu_torture_onoff_init(void)
>  {
> +	int ret;
> +
>  	if (onoff_interval <= 0)
>  		return 0;
>  	onoff_task = kthread_run(rcu_torture_onoff, NULL, "rcu_torture_onoff");
>  	if (IS_ERR(onoff_task)) {
> +		ret = PTR_ERR(onoff_task);
>  		onoff_task = NULL;
> -		return PTR_ERR(onoff_task);
> +		return ret;
>  	}
>  	return 0;
>  }
> 


      reply	other threads:[~2012-02-02 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 14:52 [PATCH 0/3] Move call to PTR_ERR after reassignment Julia Lawall
2012-02-02 14:53 ` [PATCH 1/3 v2] drivers/power/pda_power.c: " Julia Lawall
2012-02-02 14:53 ` [PATCH 2/3 v2] drivers/net/ethernet/ti: " Julia Lawall
     [not found]   ` <CABPrwzf0hH+2OOFQ2Q6ZVHwn=Ws3SvxbwVn0LwKjfkYVdP8zgg@mail.gmail.com>
2012-02-02 16:05     ` Julia Lawall
2012-02-02 19:37   ` David Miller
2012-02-02 14:53 ` [PATCH 3/3 v2] kernel/rcutorture.c: " Julia Lawall
2012-02-02 15:53   ` Paul E. McKenney [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=20120202155338.GF2518@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=Julia.Lawall@lip6.fr \
    --cc=josh@freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --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