diff options
-rw-r--r-- | include/net/netfilter/nf_tables.h | 7 | ||||
-rw-r--r-- | net/netfilter/nft_cmp.c | 2 | ||||
-rw-r--r-- | net/netfilter/nft_hash.c | 2 | ||||
-rw-r--r-- | net/netfilter/nft_rbtree.c | 11 |
4 files changed, 7 insertions, 15 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 81cd816554b9..fca0b5def629 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -69,13 +69,6 @@ struct nft_regs { | |||
69 | }; | 69 | }; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static inline int nft_data_cmp(const struct nft_data *d1, | ||
73 | const struct nft_data *d2, | ||
74 | unsigned int len) | ||
75 | { | ||
76 | return memcmp(d1->data, d2->data, len); | ||
77 | } | ||
78 | |||
79 | static inline void nft_data_copy(struct nft_data *dst, | 72 | static inline void nft_data_copy(struct nft_data *dst, |
80 | const struct nft_data *src) | 73 | const struct nft_data *src) |
81 | { | 74 | { |
diff --git a/net/netfilter/nft_cmp.c b/net/netfilter/nft_cmp.c index 59391e6a92a5..b7e1c58864cf 100644 --- a/net/netfilter/nft_cmp.c +++ b/net/netfilter/nft_cmp.c | |||
@@ -31,7 +31,7 @@ static void nft_cmp_eval(const struct nft_expr *expr, | |||
31 | const struct nft_cmp_expr *priv = nft_expr_priv(expr); | 31 | const struct nft_cmp_expr *priv = nft_expr_priv(expr); |
32 | int d; | 32 | int d; |
33 | 33 | ||
34 | d = nft_data_cmp(®s->data[priv->sreg], &priv->data, priv->len); | 34 | d = memcmp(®s->data[priv->sreg], &priv->data, priv->len); |
35 | switch (priv->op) { | 35 | switch (priv->op) { |
36 | case NFT_CMP_EQ: | 36 | case NFT_CMP_EQ: |
37 | if (d != 0) | 37 | if (d != 0) |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index b1101f71807f..26ba4e192121 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
@@ -62,7 +62,7 @@ static inline int nft_hash_cmp(struct rhashtable_compare_arg *arg, | |||
62 | const struct nft_hash_cmp_arg *x = arg->key; | 62 | const struct nft_hash_cmp_arg *x = arg->key; |
63 | const struct nft_hash_elem *he = ptr; | 63 | const struct nft_hash_elem *he = ptr; |
64 | 64 | ||
65 | if (nft_data_cmp(nft_set_ext_key(&he->ext), x->key, x->set->klen)) | 65 | if (memcmp(nft_set_ext_key(&he->ext), x->key, x->set->klen)) |
66 | return 1; | 66 | return 1; |
67 | if (nft_set_elem_expired(&he->ext)) | 67 | if (nft_set_elem_expired(&he->ext)) |
68 | return 1; | 68 | return 1; |
diff --git a/net/netfilter/nft_rbtree.c b/net/netfilter/nft_rbtree.c index 42d0ca45fb9e..b398f1a856d5 100644 --- a/net/netfilter/nft_rbtree.c +++ b/net/netfilter/nft_rbtree.c | |||
@@ -45,7 +45,7 @@ static bool nft_rbtree_lookup(const struct nft_set *set, | |||
45 | while (parent != NULL) { | 45 | while (parent != NULL) { |
46 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); | 46 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
47 | 47 | ||
48 | d = nft_data_cmp(nft_set_ext_key(&rbe->ext), key, set->klen); | 48 | d = memcmp(nft_set_ext_key(&rbe->ext), key, set->klen); |
49 | if (d < 0) { | 49 | if (d < 0) { |
50 | parent = parent->rb_left; | 50 | parent = parent->rb_left; |
51 | interval = rbe; | 51 | interval = rbe; |
@@ -91,9 +91,9 @@ static int __nft_rbtree_insert(const struct nft_set *set, | |||
91 | while (*p != NULL) { | 91 | while (*p != NULL) { |
92 | parent = *p; | 92 | parent = *p; |
93 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); | 93 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
94 | d = nft_data_cmp(nft_set_ext_key(&rbe->ext), | 94 | d = memcmp(nft_set_ext_key(&rbe->ext), |
95 | nft_set_ext_key(&new->ext), | 95 | nft_set_ext_key(&new->ext), |
96 | set->klen); | 96 | set->klen); |
97 | if (d < 0) | 97 | if (d < 0) |
98 | p = &parent->rb_left; | 98 | p = &parent->rb_left; |
99 | else if (d > 0) | 99 | else if (d > 0) |
@@ -153,8 +153,7 @@ static void *nft_rbtree_deactivate(const struct nft_set *set, | |||
153 | while (parent != NULL) { | 153 | while (parent != NULL) { |
154 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); | 154 | rbe = rb_entry(parent, struct nft_rbtree_elem, node); |
155 | 155 | ||
156 | d = nft_data_cmp(nft_set_ext_key(&rbe->ext), &elem->key, | 156 | d = memcmp(nft_set_ext_key(&rbe->ext), &elem->key, set->klen); |
157 | set->klen); | ||
158 | if (d < 0) | 157 | if (d < 0) |
159 | parent = parent->rb_left; | 158 | parent = parent->rb_left; |
160 | else if (d > 0) | 159 | else if (d > 0) |