]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: nf_tables: prefer skb_ensure_writable
authorFlorian Westphal <fw@strlen.de>
Thu, 23 May 2019 13:44:09 +0000 (15:44 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 31 May 2019 16:02:46 +0000 (18:02 +0200)
.. so skb_make_writable can be removed.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nft_exthdr.c
net/netfilter/nft_payload.c

index a940c9fd9045e5495a42d93f76db26283c6de5f1..45c8a6c077837614e6ea1c68a949af3114978e14 100644 (file)
@@ -156,7 +156,8 @@ static void nft_exthdr_tcp_set_eval(const struct nft_expr *expr,
                if (i + optl > tcphdr_len || priv->len + priv->offset > optl)
                        return;
 
-               if (!skb_make_writable(pkt->skb, pkt->xt.thoff + i + priv->len))
+               if (skb_ensure_writable(pkt->skb,
+                                       pkt->xt.thoff + i + priv->len))
                        return;
 
                tcph = nft_tcp_header_pointer(pkt, sizeof(buff), buff,
index 54e15de4b79a09f5a938759d4c91feddd501c18e..1465b7d6d2b0cec95d3e5b8678528ce98b1cbb9a 100644 (file)
@@ -243,7 +243,7 @@ static int nft_payload_l4csum_update(const struct nft_pktinfo *pkt,
                                          tsum));
        }
 
-       if (!skb_make_writable(skb, l4csum_offset + sizeof(sum)) ||
+       if (skb_ensure_writable(skb, l4csum_offset + sizeof(sum)) ||
            skb_store_bits(skb, l4csum_offset, &sum, sizeof(sum)) < 0)
                return -1;
 
@@ -259,7 +259,7 @@ static int nft_payload_csum_inet(struct sk_buff *skb, const u32 *src,
                return -1;
 
        nft_csum_replace(&sum, fsum, tsum);
-       if (!skb_make_writable(skb, csum_offset + sizeof(sum)) ||
+       if (skb_ensure_writable(skb, csum_offset + sizeof(sum)) ||
            skb_store_bits(skb, csum_offset, &sum, sizeof(sum)) < 0)
                return -1;
 
@@ -312,7 +312,7 @@ static void nft_payload_set_eval(const struct nft_expr *expr,
                        goto err;
        }
 
-       if (!skb_make_writable(skb, max(offset + priv->len, 0)) ||
+       if (skb_ensure_writable(skb, max(offset + priv->len, 0)) ||
            skb_store_bits(skb, offset, src, priv->len) < 0)
                goto err;