summaryrefslogtreecommitdiffstats
path: root/drivers/char/mmtimer.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2010-03-11 00:23:52 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-13 00:52:43 +0100
commit0fbcae222b8aa3a47034a484e02e7fc14050c783 (patch)
treebd1dc7bb8c912e7f29f490aebcf7270141072e26 /drivers/char/mmtimer.c
parentw1: mxc_w1: move probe() and remove() to the dev* text area (diff)
downloadlinux-0fbcae222b8aa3a47034a484e02e7fc14050c783.tar.xz
linux-0fbcae222b8aa3a47034a484e02e7fc14050c783.zip
drivers/char/mmtimer.c: eliminate useless code
The variable x is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // <smpl> @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(...) ... when != x ( x = f(...,<+...x...+>,...) | * x = f(...) ) // </smpl> Stefan observed: The next x = rb_entry(mn->next, struct mmtimer, list); is preceded by a test whether mn->next is NULL. Unless that test is redundant too, your patch fixes a potential NULL pointer dereference, introduced by commit cbacdd95 "SGI Altix mmtimer: allow larger number of timers per node" in 2.6.26. Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de> Cc: Dimitri Sivanich <sivanich@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--drivers/char/mmtimer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 918711aa56f3..04fd0d843b3b 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -546,7 +546,7 @@ static void mmtimer_tasklet(unsigned long data)
{
int nodeid = data;
struct mmtimer_node *mn = &timers[nodeid];
- struct mmtimer *x = rb_entry(mn->next, struct mmtimer, list);
+ struct mmtimer *x;
struct k_itimer *t;
unsigned long flags;