[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20100127132852.GC15611@ff.dom.local>
Date: Wed, 27 Jan 2010 13:28:52 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: David Miller <davem@...emloft.net>
Cc: shemminger@...tta.com, djohnson@...rentnetworks.com,
sakkiped@...rentnetworks.com, netdev@...r.kernel.org
Subject: Re: [PATCH] ipv6: Fix possible NULL dereference in icmp6_dst_alloc
On Wed, Jan 27, 2010 at 05:14:10AM -0800, David Miller wrote:
> From: Jarek Poplawski <jarkao2@...il.com>
> Date: Wed, 27 Jan 2010 12:43:31 +0000
>
> > I'm only not sure there is a better way (comments?) to make this
> > code readable.
>
> You can make it more readable and even validate the invariant at the
> same time by adding some kind of inline function if you wish.
>
> static inline struct dst_entry *rtable_to_dst_entry(struct rtable *rt)
> {
> BUILD_BUG_ON(rt != &rt->u.dst);
>
> /* Because "->u.dst" is the first member of struct rtable,
> * this dereference is safe even when rt is NULL.
> */
> return &rt->u.dst;
> }
>
> Something like that.
Yes, it looks the most readable to me.
Thanks,
Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists