[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100127.051410.74328462.davem@davemloft.net>
Date: Wed, 27 Jan 2010 05:14:10 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: jarkao2@...il.com
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
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.
--
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