lkml.org 
[lkml]   [2018]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 2/3] tracing: clear parser->idx if parser gets nothing
Date
From: Changbin Du <changbin.du@intel.com>

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@intel.com>
---
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
\
 
 \ /
  Last update: 2018-01-16 10:12    [W:0.047 / U:0.124 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site