]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv6/mip6.c
net: convert BUG_TRAP to generic WARN_ON
[net-next-2.6.git] / net / ipv6 / mip6.c
index 42403c626c272e521c619a6ae142478765b696a2..31295c8f619688099477dd5e230c61f8199d51da 100644 (file)
@@ -44,9 +44,9 @@ static inline void *mip6_padn(__u8 *data, __u8 padlen)
        if (!data)
                return NULL;
        if (padlen == 1) {
-               data[0] = MIP6_OPT_PAD_1;
+               data[0] = IPV6_TLV_PAD0;
        } else if (padlen > 1) {
-               data[0] = MIP6_OPT_PAD_N;
+               data[0] = IPV6_TLV_PADN;
                data[1] = padlen - 2;
                if (padlen > 2)
                        memset(data+2, 0, data[1]);
@@ -164,8 +164,8 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb)
                        calc_padlen(sizeof(*dstopt), 6));
 
        hao->type = IPV6_TLV_HAO;
+       BUILD_BUG_ON(sizeof(*hao) != 18);
        hao->length = sizeof(*hao) - 2;
-       BUG_TRAP(hao->length == 16);
 
        len = ((char *)hao - (char *)dstopt) + sizeof(*hao);
 
@@ -174,7 +174,7 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb)
        memcpy(&iph->saddr, x->coaddr, sizeof(iph->saddr));
        spin_unlock_bh(&x->lock);
 
-       BUG_TRAP(len == x->props.header_len);
+       WARN_ON(len != x->props.header_len);
        dstopt->hdrlen = (x->props.header_len >> 3) - 1;
 
        return 0;
@@ -317,7 +317,7 @@ static int mip6_destopt_init_state(struct xfrm_state *x)
        x->props.header_len = sizeof(struct ipv6_destopt_hdr) +
                calc_padlen(sizeof(struct ipv6_destopt_hdr), 6) +
                sizeof(struct ipv6_destopt_hao);
-       BUG_TRAP(x->props.header_len == 24);
+       WARN_ON(x->props.header_len != 24);
 
        return 0;
 }
@@ -380,7 +380,7 @@ static int mip6_rthdr_output(struct xfrm_state *x, struct sk_buff *skb)
        rt2->rt_hdr.segments_left = 1;
        memset(&rt2->reserved, 0, sizeof(rt2->reserved));
 
-       BUG_TRAP(rt2->rt_hdr.hdrlen == 2);
+       WARN_ON(rt2->rt_hdr.hdrlen != 2);
 
        memcpy(&rt2->addr, &iph->daddr, sizeof(rt2->addr));
        spin_lock_bh(&x->lock);