diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2017-02-10 22:21:55 +0900 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-02-15 10:32:48 -0500 |
commit | bef5da60595f5706232e2502876f8545743b9b41 (patch) | |
tree | c2a46613ed750c5a84b8404219cafbc8f14ad413 | |
parent | 8f0994bb8cbde5452e58ce0cacdbf6cb58079d01 (diff) | |
download | linux-bef5da60595f5706232e2502876f8545743b9b41.tar.bz2 |
tracing/probes: Fix a warning message to show correct maximum length
Since tracing/*probe_events will accept a probe definition
up to 4096 - 2 ('\n' and '\0') bytes, it must show 4094 instead
of 4096 in warning message.
Note that there is one possible case of exceed 4094. If user
prepare 4096 bytes null-terminated string and syscall write
it with the count == 4095, then it can be accepted. However,
if user puts a '\n' after that, it must rejected.
So IMHO, the warning message should indicate shorter one,
since it is safer.
Link: http://lkml.kernel.org/r/148673290462.2579.7966778294009665632.stgit@devbox
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel/trace/trace_probe.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 11b63328d6fb..52478f033f88 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -679,8 +679,9 @@ ssize_t traceprobe_probes_write(struct file *file, const char __user *buffer, if (done + size < count) { if (buf != kbuf) break; + /* This can accept WRITE_BUFSIZE - 2 ('\n' + '\0') */ pr_warn("Line length is too long: Should be less than %d\n", - WRITE_BUFSIZE); + WRITE_BUFSIZE - 2); ret = -EINVAL; goto out; } |