提交 43138833 编写于 作者: J Joonwoo Park 提交者: David S. Miller

textsearch: ts_fsm: return error on request for case insensitive search

For fsm text search, handle case insensitive parameter as -EINVAL.
Signed-off-by: NJoonwoo Park <joonwpark81@gmail.com>
Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 2523c3fc
...@@ -257,7 +257,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state) ...@@ -257,7 +257,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
} }
static struct ts_config *fsm_init(const void *pattern, unsigned int len, static struct ts_config *fsm_init(const void *pattern, unsigned int len,
gfp_t gfp_mask) gfp_t gfp_mask, int flags)
{ {
int i, err = -EINVAL; int i, err = -EINVAL;
struct ts_config *conf; struct ts_config *conf;
...@@ -269,6 +269,9 @@ static struct ts_config *fsm_init(const void *pattern, unsigned int len, ...@@ -269,6 +269,9 @@ static struct ts_config *fsm_init(const void *pattern, unsigned int len,
if (len % sizeof(struct ts_fsm_token) || ntokens < 1) if (len % sizeof(struct ts_fsm_token) || ntokens < 1)
goto errout; goto errout;
if (flags & TS_IGNORECASE)
goto errout;
for (i = 0; i < ntokens; i++) { for (i = 0; i < ntokens; i++) {
struct ts_fsm_token *t = &tokens[i]; struct ts_fsm_token *t = &tokens[i];
...@@ -284,6 +287,7 @@ static struct ts_config *fsm_init(const void *pattern, unsigned int len, ...@@ -284,6 +287,7 @@ static struct ts_config *fsm_init(const void *pattern, unsigned int len,
if (IS_ERR(conf)) if (IS_ERR(conf))
return conf; return conf;
conf->flags = flags;
fsm = ts_config_priv(conf); fsm = ts_config_priv(conf);
fsm->ntokens = ntokens; fsm->ntokens = ntokens;
memcpy(fsm->tokens, pattern, len); memcpy(fsm->tokens, pattern, len);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册