aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-07-07 01:54:08 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-10 05:59:42 -0400
commit011ed56853e07e30653d6f1bfddc56b396218664 (patch)
treea172911c83f2a0f9ae23a5d160860827929d60f9
parent92cf9f8f7e89c6bdbb1a724f879b8b18fc0dfe0f (diff)
ksym_tracer: NIL-terminate user input filter
Make sure the user input string is NULL-terminated. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Frederic 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: Ingo Molnar <mingo@elte.hu>
-rw-r--r--kernel/trace/trace_ksym.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/kernel/trace/trace_ksym.c b/kernel/trace/trace_ksym.c
index 72fcb46c39c0..8cbed5a6286f 100644
--- a/kernel/trace/trace_ksym.c
+++ b/kernel/trace/trace_ksym.c
@@ -264,11 +264,7 @@ static ssize_t ksym_trace_filter_write(struct file *file,
264 unsigned long ksym_addr = 0; 264 unsigned long ksym_addr = 0;
265 int ret, op, changed = 0; 265 int ret, op, changed = 0;
266 266
267 /* Ignore echo "" > ksym_trace_filter */ 267 input_string = kzalloc(count + 1, GFP_KERNEL);
268 if (count == 0)
269 return 0;
270
271 input_string = kzalloc(count, GFP_KERNEL);
272 if (!input_string) 268 if (!input_string)
273 return -ENOMEM; 269 return -ENOMEM;
274 270
@@ -276,6 +272,7 @@ static ssize_t ksym_trace_filter_write(struct file *file,
276 kfree(input_string); 272 kfree(input_string);
277 return -EFAULT; 273 return -EFAULT;
278 } 274 }
275 input_string[count] = '\0';
279 276
280 ret = op = parse_ksym_trace_str(input_string, &ksymname, &ksym_addr); 277 ret = op = parse_ksym_trace_str(input_string, &ksymname, &ksym_addr);
281 if (ret < 0) { 278 if (ret < 0) {