diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-02-02 10:52:54 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-02-21 12:06:10 -0500 |
commit | 3c1b1ce00d2702d6be9b92233822e560f37ea780 (patch) | |
tree | 302e888faea366f7caccd6ad946bdde6d8e9137e /kernel/rcutorture.c | |
parent | bde23c6892878e48f64de668660778991bc2fb56 (diff) |
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>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index ed1c72bd9c09..a89b381a8c6e 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -1465,12 +1465,15 @@ rcu_torture_onoff(void *arg) | |||
1465 | static int __cpuinit | 1465 | static int __cpuinit |
1466 | rcu_torture_onoff_init(void) | 1466 | rcu_torture_onoff_init(void) |
1467 | { | 1467 | { |
1468 | int ret; | ||
1469 | |||
1468 | if (onoff_interval <= 0) | 1470 | if (onoff_interval <= 0) |
1469 | return 0; | 1471 | return 0; |
1470 | onoff_task = kthread_run(rcu_torture_onoff, NULL, "rcu_torture_onoff"); | 1472 | onoff_task = kthread_run(rcu_torture_onoff, NULL, "rcu_torture_onoff"); |
1471 | if (IS_ERR(onoff_task)) { | 1473 | if (IS_ERR(onoff_task)) { |
1474 | ret = PTR_ERR(onoff_task); | ||
1472 | onoff_task = NULL; | 1475 | onoff_task = NULL; |
1473 | return PTR_ERR(onoff_task); | 1476 | return ret; |
1474 | } | 1477 | } |
1475 | return 0; | 1478 | return 0; |
1476 | } | 1479 | } |