x86/smpboot: Init apic mapping before usage
[cascardo/linux.git] / net / netfilter / nft_exthdr.c
index 82c264e..a84cf3d 100644 (file)
@@ -59,7 +59,7 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,
                           const struct nlattr * const tb[])
 {
        struct nft_exthdr *priv = nft_expr_priv(expr);
-       u32 offset, len;
+       u32 offset, len, err;
 
        if (tb[NFTA_EXTHDR_DREG] == NULL ||
            tb[NFTA_EXTHDR_TYPE] == NULL ||
@@ -67,11 +67,13 @@ static int nft_exthdr_init(const struct nft_ctx *ctx,
            tb[NFTA_EXTHDR_LEN] == NULL)
                return -EINVAL;
 
-       offset = ntohl(nla_get_be32(tb[NFTA_EXTHDR_OFFSET]));
-       len = ntohl(nla_get_be32(tb[NFTA_EXTHDR_LEN]));
+       err = nft_parse_u32_check(tb[NFTA_EXTHDR_OFFSET], U8_MAX, &offset);
+       if (err < 0)
+               return err;
 
-       if (offset > U8_MAX || len > U8_MAX)
-               return -ERANGE;
+       err = nft_parse_u32_check(tb[NFTA_EXTHDR_LEN], U8_MAX, &len);
+       if (err < 0)
+               return err;
 
        priv->type   = nla_get_u8(tb[NFTA_EXTHDR_TYPE]);
        priv->offset = offset;