[PATCH v2 2/3] tracing: clear parser->idx if parser gets nothing
From: changbin . du
Date: Mon Jan 15 2018 - 06:50:37 EST
From: Changbin Du <changbin.du@xxxxxxxxx>
If only spaces was got in that cycle, we should clear parser->idx to make
trace_parser_loaded() return false.
Signed-off-by: Changbin Du <changbin.du@xxxxxxxxx>
---
kernel/trace/trace.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 144d08e..b44926e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1236,14 +1236,14 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
cnt--;
}
+ parser->idx = 0;
+
/* only spaces were written */
if (isspace(ch) || !ch) {
*ppos += read;
ret = read;
goto out;
}
-
- parser->idx = 0;
}
/* read the non-space input */
--
2.7.4