lkml.org 
[lkml]   [2010]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/9] drivers/char: Eliminate useless code
Julia Lawall wrote:
> The variable x is initialized twice to the same (side effect-free)
> expression. Drop one initialization.
[...]
> --- a/drivers/char/mmtimer.c
> +++ b/drivers/char/mmtimer.c
> @@ -546,9 +546,9 @@ 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;

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.
--
Stefan Richter
-=====-==-=- ---= =---=
http://arcgraph.de/sr/

\
 
 \ /
  Last update: 2010-01-17 12:43    [from the cache]
©2003-2011 Jasper Spaans