Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0a8891a0a419d43ea06c8ded0849f0820c6a873b
Commit:     0a8891a0a419d43ea06c8ded0849f0820c6a873b
Parent:     4665079cbb2a3e17de82f2ab2940b9f97f37d65e
Author:     Benjamin Thery <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 8 20:39:36 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:54:58 2007 -0700

    [IPv6]: use container_of() macro in fib6_clean_node()
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv6/ip6_fib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 6a612a7..946cf38 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to