Commit 0a8891a0a419d43ea06c8ded0849f0820c6a873b
Committed by
David S. Miller
1 parent
4665079cbb
Exists in
master
and in
7 other branches
[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 <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
net/ipv6/ip6_fib.c
... | ... | @@ -1313,7 +1313,7 @@ |
1313 | 1313 | { |
1314 | 1314 | int res; |
1315 | 1315 | struct rt6_info *rt; |
1316 | - struct fib6_cleaner_t *c = (struct fib6_cleaner_t*)w; | |
1316 | + struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w); | |
1317 | 1317 | |
1318 | 1318 | for (rt = w->leaf; rt; rt = rt->u.dst.rt6_next) { |
1319 | 1319 | res = c->func(rt, c->arg); |