diff options
author | Bojan Prtvar <prtvar.b@gmail.com> | 2015-02-22 05:46:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-22 15:59:54 -0500 |
commit | 059a2440fd3cf4ec57735db2c0a90401cde84fca (patch) | |
tree | ae1cc62a03192b53b6d4c1eb14b50d534b385797 | |
parent | d340c862e760815bca2f2a4d8fd91dff4646a955 (diff) |
net: Remove state argument from skb_find_text()
Although it is clear that textsearch state is intentionally passed to
skb_find_text() as uninitialized argument, it was never used by the
callers. Therefore, we can simplify skb_find_text() by making it
local variable.
Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 3 | ||||
-rw-r--r-- | net/core/skbuff.c | 9 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_amanda.c | 10 | ||||
-rw-r--r-- | net/netfilter/xt_string.c | 3 | ||||
-rw-r--r-- | net/sched/em_text.c | 3 |
5 files changed, 10 insertions, 18 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 30007afe70b3..d898b32dedcc 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -870,8 +870,7 @@ unsigned int skb_seq_read(unsigned int consumed, const u8 **data, | |||
870 | void skb_abort_seq_read(struct skb_seq_state *st); | 870 | void skb_abort_seq_read(struct skb_seq_state *st); |
871 | 871 | ||
872 | unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | 872 | unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, |
873 | unsigned int to, struct ts_config *config, | 873 | unsigned int to, struct ts_config *config); |
874 | struct ts_state *state); | ||
875 | 874 | ||
876 | /* | 875 | /* |
877 | * Packet hash types specify the type of hash in skb_set_hash. | 876 | * Packet hash types specify the type of hash in skb_set_hash. |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 88c613eab142..374e43bc6b80 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2865,7 +2865,6 @@ static void skb_ts_finish(struct ts_config *conf, struct ts_state *state) | |||
2865 | * @from: search offset | 2865 | * @from: search offset |
2866 | * @to: search limit | 2866 | * @to: search limit |
2867 | * @config: textsearch configuration | 2867 | * @config: textsearch configuration |
2868 | * @state: uninitialized textsearch state variable | ||
2869 | * | 2868 | * |
2870 | * Finds a pattern in the skb data according to the specified | 2869 | * Finds a pattern in the skb data according to the specified |
2871 | * textsearch configuration. Use textsearch_next() to retrieve | 2870 | * textsearch configuration. Use textsearch_next() to retrieve |
@@ -2873,17 +2872,17 @@ static void skb_ts_finish(struct ts_config *conf, struct ts_state *state) | |||
2873 | * to the first occurrence or UINT_MAX if no match was found. | 2872 | * to the first occurrence or UINT_MAX if no match was found. |
2874 | */ | 2873 | */ |
2875 | unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, | 2874 | unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, |
2876 | unsigned int to, struct ts_config *config, | 2875 | unsigned int to, struct ts_config *config) |
2877 | struct ts_state *state) | ||
2878 | { | 2876 | { |
2877 | struct ts_state state; | ||
2879 | unsigned int ret; | 2878 | unsigned int ret; |
2880 | 2879 | ||
2881 | config->get_next_block = skb_ts_get_next_block; | 2880 | config->get_next_block = skb_ts_get_next_block; |
2882 | config->finish = skb_ts_finish; | 2881 | config->finish = skb_ts_finish; |
2883 | 2882 | ||
2884 | skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state)); | 2883 | skb_prepare_seq_read(skb, from, to, TS_SKB_CB(&state)); |
2885 | 2884 | ||
2886 | ret = textsearch_find(config, state); | 2885 | ret = textsearch_find(config, &state); |
2887 | return (ret <= to - from ? ret : UINT_MAX); | 2886 | return (ret <= to - from ? ret : UINT_MAX); |
2888 | } | 2887 | } |
2889 | EXPORT_SYMBOL(skb_find_text); | 2888 | EXPORT_SYMBOL(skb_find_text); |
diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c index b8b95f4027ca..57a26cc90c9f 100644 --- a/net/netfilter/nf_conntrack_amanda.c +++ b/net/netfilter/nf_conntrack_amanda.c | |||
@@ -88,7 +88,6 @@ static int amanda_help(struct sk_buff *skb, | |||
88 | struct nf_conn *ct, | 88 | struct nf_conn *ct, |
89 | enum ip_conntrack_info ctinfo) | 89 | enum ip_conntrack_info ctinfo) |
90 | { | 90 | { |
91 | struct ts_state ts; | ||
92 | struct nf_conntrack_expect *exp; | 91 | struct nf_conntrack_expect *exp; |
93 | struct nf_conntrack_tuple *tuple; | 92 | struct nf_conntrack_tuple *tuple; |
94 | unsigned int dataoff, start, stop, off, i; | 93 | unsigned int dataoff, start, stop, off, i; |
@@ -113,23 +112,20 @@ static int amanda_help(struct sk_buff *skb, | |||
113 | return NF_ACCEPT; | 112 | return NF_ACCEPT; |
114 | } | 113 | } |
115 | 114 | ||
116 | memset(&ts, 0, sizeof(ts)); | ||
117 | start = skb_find_text(skb, dataoff, skb->len, | 115 | start = skb_find_text(skb, dataoff, skb->len, |
118 | search[SEARCH_CONNECT].ts, &ts); | 116 | search[SEARCH_CONNECT].ts); |
119 | if (start == UINT_MAX) | 117 | if (start == UINT_MAX) |
120 | goto out; | 118 | goto out; |
121 | start += dataoff + search[SEARCH_CONNECT].len; | 119 | start += dataoff + search[SEARCH_CONNECT].len; |
122 | 120 | ||
123 | memset(&ts, 0, sizeof(ts)); | ||
124 | stop = skb_find_text(skb, start, skb->len, | 121 | stop = skb_find_text(skb, start, skb->len, |
125 | search[SEARCH_NEWLINE].ts, &ts); | 122 | search[SEARCH_NEWLINE].ts); |
126 | if (stop == UINT_MAX) | 123 | if (stop == UINT_MAX) |
127 | goto out; | 124 | goto out; |
128 | stop += start; | 125 | stop += start; |
129 | 126 | ||
130 | for (i = SEARCH_DATA; i <= SEARCH_INDEX; i++) { | 127 | for (i = SEARCH_DATA; i <= SEARCH_INDEX; i++) { |
131 | memset(&ts, 0, sizeof(ts)); | 128 | off = skb_find_text(skb, start, stop, search[i].ts); |
132 | off = skb_find_text(skb, start, stop, search[i].ts, &ts); | ||
133 | if (off == UINT_MAX) | 129 | if (off == UINT_MAX) |
134 | continue; | 130 | continue; |
135 | off += start + search[i].len; | 131 | off += start + search[i].len; |
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c index 5699adb97652..0bc3460319c8 100644 --- a/net/netfilter/xt_string.c +++ b/net/netfilter/xt_string.c | |||
@@ -26,13 +26,12 @@ static bool | |||
26 | string_mt(const struct sk_buff *skb, struct xt_action_param *par) | 26 | string_mt(const struct sk_buff *skb, struct xt_action_param *par) |
27 | { | 27 | { |
28 | const struct xt_string_info *conf = par->matchinfo; | 28 | const struct xt_string_info *conf = par->matchinfo; |
29 | struct ts_state state; | ||
30 | bool invert; | 29 | bool invert; |
31 | 30 | ||
32 | invert = conf->u.v1.flags & XT_STRING_FLAG_INVERT; | 31 | invert = conf->u.v1.flags & XT_STRING_FLAG_INVERT; |
33 | 32 | ||
34 | return (skb_find_text((struct sk_buff *)skb, conf->from_offset, | 33 | return (skb_find_text((struct sk_buff *)skb, conf->from_offset, |
35 | conf->to_offset, conf->config, &state) | 34 | conf->to_offset, conf->config) |
36 | != UINT_MAX) ^ invert; | 35 | != UINT_MAX) ^ invert; |
37 | } | 36 | } |
38 | 37 | ||
diff --git a/net/sched/em_text.c b/net/sched/em_text.c index f03c3de16c27..73e2ed576ceb 100644 --- a/net/sched/em_text.c +++ b/net/sched/em_text.c | |||
@@ -34,7 +34,6 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m, | |||
34 | { | 34 | { |
35 | struct text_match *tm = EM_TEXT_PRIV(m); | 35 | struct text_match *tm = EM_TEXT_PRIV(m); |
36 | int from, to; | 36 | int from, to; |
37 | struct ts_state state; | ||
38 | 37 | ||
39 | from = tcf_get_base_ptr(skb, tm->from_layer) - skb->data; | 38 | from = tcf_get_base_ptr(skb, tm->from_layer) - skb->data; |
40 | from += tm->from_offset; | 39 | from += tm->from_offset; |
@@ -42,7 +41,7 @@ static int em_text_match(struct sk_buff *skb, struct tcf_ematch *m, | |||
42 | to = tcf_get_base_ptr(skb, tm->to_layer) - skb->data; | 41 | to = tcf_get_base_ptr(skb, tm->to_layer) - skb->data; |
43 | to += tm->to_offset; | 42 | to += tm->to_offset; |
44 | 43 | ||
45 | return skb_find_text(skb, from, to, tm->config, &state) != UINT_MAX; | 44 | return skb_find_text(skb, from, to, tm->config) != UINT_MAX; |
46 | } | 45 | } |
47 | 46 | ||
48 | static int em_text_change(struct net *net, void *data, int len, | 47 | static int em_text_change(struct net *net, void *data, int len, |