Skip to content

Commit

Permalink
tracing: cleanup for tracing_trace_options_read()
Browse files Browse the repository at this point in the history
'\n' is already appended, and what we need is just an extra
space for the '\0'.

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
LKML-Reference: <4A3EED63.3090908@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Xiao Guangrong authored and Steven Rostedt committed Jul 20, 2009
1 parent 7d536cb commit ff4e9da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2256,8 +2256,8 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf,
len += 3; /* "no" and newline */
}

/* +2 for \n and \0 */
buf = kmalloc(len + 2, GFP_KERNEL);
/* +1 for \0 */
buf = kmalloc(len + 1, GFP_KERNEL);
if (!buf) {
mutex_unlock(&trace_types_lock);
return -ENOMEM;
Expand All @@ -2280,7 +2280,7 @@ tracing_trace_options_read(struct file *filp, char __user *ubuf,
}
mutex_unlock(&trace_types_lock);

WARN_ON(r >= len + 2);
WARN_ON(r >= len + 1);

r = simple_read_from_buffer(ubuf, cnt, ppos, buf, r);

Expand Down

0 comments on commit ff4e9da

Please sign in to comment.