Permalink
Browse files

ipv6: check return value for dst_alloc

return value of dst_alloc must be checked before use

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information...
1 parent 25914de commit a0e6c2f9f297c760797980d9ccfe2eb00fc5b46d @madalinbucur madalinbucur committed with jpa-github Sep 26, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 net/ipv6/route.c
View
@@ -233,7 +233,9 @@ static inline struct rt6_info *ip6_dst_alloc(struct dst_ops *ops,
{
struct rt6_info *rt = dst_alloc(ops, dev, 0, 0, flags);
- memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
+ if (rt != NULL)
+ memset(&rt->rt6i_table, 0,
+ sizeof(*rt) - sizeof(struct dst_entry));
return rt;
}

0 comments on commit a0e6c2f

Please sign in to comment.