diff options
| author | Peter Maydell | 2019-03-25 18:01:10 +0100 |
|---|---|---|
| committer | Peter Maydell | 2019-03-25 18:01:10 +0100 |
| commit | d132baa05ed7a647067c807fd452ec794cc2ecb7 (patch) | |
| tree | 3cb6fdefdd3e2e86769eca5413328e01f36602a0 /trace | |
| parent | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190325'... (diff) | |
| parent | trace-events: Fix attribution of trace points to source (diff) | |
| download | qemu-d132baa05ed7a647067c807fd452ec794cc2ecb7.tar.gz qemu-d132baa05ed7a647067c807fd452ec794cc2ecb7.tar.xz qemu-d132baa05ed7a647067c807fd452ec794cc2ecb7.zip | |
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Pull request
Compilation fixes and cleanups for QEMU 4.0.0.
# gpg: Signature made Mon 25 Mar 2019 15:58:28 GMT
# gpg: using RSA key 9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8
* remotes/stefanha/tags/tracing-pull-request:
trace-events: Fix attribution of trace points to source
trace-events: Delete unused trace points
scripts/cleanup-trace-events: Update for current practice
trace-events: Shorten file names in comments
trace-events: Consistently point to docs/devel/tracing.txt
trace: avoid SystemTap dtrace(1) warnings on empty files
trace: handle tracefs path truncation
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'trace')
| -rw-r--r-- | trace/ftrace.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/trace/ftrace.c b/trace/ftrace.c index 61692a8682..9749543d9b 100644 --- a/trace/ftrace.c +++ b/trace/ftrace.c @@ -53,7 +53,11 @@ bool ftrace_init(void) } if (tracefs_found) { - snprintf(path, PATH_MAX, "%s%s/tracing_on", mount_point, subdir); + if (snprintf(path, PATH_MAX, "%s%s/tracing_on", mount_point, subdir) + >= sizeof(path)) { + fprintf(stderr, "Using tracefs mountpoint would exceed PATH_MAX\n"); + return false; + } trace_fd = open(path, O_WRONLY); if (trace_fd < 0) { if (errno == EACCES) { @@ -72,7 +76,11 @@ bool ftrace_init(void) } close(trace_fd); } - snprintf(path, PATH_MAX, "%s%s/trace_marker", mount_point, subdir); + if (snprintf(path, PATH_MAX, "%s%s/trace_marker", mount_point, subdir) + >= sizeof(path)) { + fprintf(stderr, "Using tracefs mountpoint would exceed PATH_MAX\n"); + return false; + } trace_marker_fd = open(path, O_WRONLY); if (trace_marker_fd < 0) { perror("Could not open ftrace 'trace_marker' file"); |
