]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IPv6]: use container_of() macro in fib6_clean_node()
authorBenjamin Thery <benjamin.thery@bull.net>
Tue, 9 Oct 2007 03:39:36 +0000 (20:39 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Wed, 10 Oct 2007 23:54:58 +0000 (16:54 -0700)
In ip6_fib.c, fib6_clean_node() casts a fib6_walker_t pointer to
a fib6_cleaner_t pointer assuming a struct fib6_walker_t (field 'w')
is the first field in struct fib6_walker_t.

To prevent any future problems that may occur if one day a field
is inadvertently inserted before the 'w' field in struct fib6_cleaner_t,
(and to improve readability), this patch uses the container_of() macro.

Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_fib.c

index 6a612a701eaaa34b35d6d7778b80c7f62c6bde31..946cf389ab95716a27a98fda7ca448b99524993c 100644 (file)
@@ -1313,7 +1313,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
 {
        int res;
        struct rt6_info *rt;
-       struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w;
+       struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
 
        for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) {
                res = c->func(rt, c->arg);