* [PATCH] [IPv6]: use container_of() macro in fib6_clean_node()
@ 2007-10-08 16:33 Benjamin Thery
2007-10-09 3:40 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Thery @ 2007-10-08 16:33 UTC (permalink / raw)
To: David Miller, netdev
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.
Patch for net-2.6.24
Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
---
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [IPv6]: use container_of() macro in fib6_clean_node()
2007-10-08 16:33 [PATCH] [IPv6]: use container_of() macro in fib6_clean_node() Benjamin Thery
@ 2007-10-09 3:40 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-10-09 3:40 UTC (permalink / raw)
To: benjamin.thery; +Cc: netdev
From: Benjamin Thery <benjamin.thery@bull.net>
Date: Mon, 08 Oct 2007 18:33:16 +0200
> 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.
>
> Patch for net-2.6.24
>
> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net>
Applied, thanks Benjamin.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-09 3:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 16:33 [PATCH] [IPv6]: use container_of() macro in fib6_clean_node() Benjamin Thery
2007-10-09 3:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).