From: Changbin Du Date: Tue, 16 Jan 2018 09:02:29 +0000 (+0800) Subject: tracing: Clear parser->idx if only spaces are read X-Git-Tag: v5.15~9416^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76638d96502744b0d593f2386b75ae5a017c13bb;p=platform%2Fkernel%2Flinux-starfive.git tracing: Clear parser->idx if only spaces are read If only spaces were read while parsing the next string, then parser->idx should be cleared in order to make trace_parser_loaded() return false. Link: http://lkml.kernel.org/r/1516093350-12045-3-git-send-email-changbin.du@intel.com Acked-by: Namhyung Kim Signed-off-by: Changbin Du Signed-off-by: Steven Rostedt (VMware) --- diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index c00a31d18f8a..cb90435e63da 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 */