提交 011ed568 编写于 作者: L Li Zefan 提交者: Ingo Molnar

ksym_tracer: NIL-terminate user input filter

Make sure the user input string is NULL-terminated.
Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4A52E300.7020601@cn.fujitsu.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 92cf9f8f
......@@ -264,11 +264,7 @@ static ssize_t ksym_trace_filter_write(struct file *file,
unsigned long ksym_addr = 0;
int ret, op, changed = 0;
/* Ignore echo "" > ksym_trace_filter */
if (count == 0)
return 0;
input_string = kzalloc(count, GFP_KERNEL);
input_string = kzalloc(count + 1, GFP_KERNEL);
if (!input_string)
return -ENOMEM;
......@@ -276,6 +272,7 @@ static ssize_t ksym_trace_filter_write(struct file *file,
kfree(input_string);
return -EFAULT;
}
input_string[count] = '\0';
ret = op = parse_ksym_trace_str(input_string, &ksymname, &ksym_addr);
if (ret < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册