diff options
author | Chang-Hsien Tsai <luke.tw@gmail.com> | 2019-05-19 12:05:44 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-21 10:04:17 +0300 |
commit | 1772f38b97a22616a503a7d61c921fd72ba1200b (patch) | |
tree | 865148e48f8c719fd2f91af54c92a5093871cc05 /tools/perf/builtin-ftrace.c | |
parent | c83caff2c12f18e68e51635eb31fd4e5146ebf55 (diff) | |
download | linux-1772f38b97a22616a503a7d61c921fd72ba1200b.tar.xz |
samples, bpf: fix to change the buffer size for read()
[ Upstream commit f7c2d64bac1be2ff32f8e4f500c6e5429c1003e0 ]
If the trace for read is larger than 4096, the return
value sz will be 4096. This results in off-by-one error
on buf:
static char buf[4096];
ssize_t sz;
sz = read(trace_fd, buf, sizeof(buf));
if (sz > 0) {
buf[sz] = 0;
puts(buf);
}
Signed-off-by: Chang-Hsien Tsai <luke.tw@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/perf/builtin-ftrace.c')
0 files changed, 0 insertions, 0 deletions