diff mbox series

trace-cmd: Make name and cpu_pid into const pointers to tracecmd_get_guest_cpumap()

Message ID 20200305134418.4ca07214@gandalf.local.home (mailing list archive)
State Accepted
Commit dbe8aaf65107439a46e49dd40ecd577e5ea93660
Headers show
Series trace-cmd: Make name and cpu_pid into const pointers to tracecmd_get_guest_cpumap() | expand

Commit Message

Steven Rostedt March 5, 2020, 6:44 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

As both the name and cpu_pid return pointers to the actual data of the
tracecmd_handle, they should be constant to make sure that the callers do
not try to modify them.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace-cmd/trace-cmd.h | 4 ++--
 lib/trace-cmd/trace-input.c   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
index 0375f500..2643b889 100644
--- a/include/trace-cmd/trace-cmd.h
+++ b/include/trace-cmd/trace-cmd.h
@@ -157,8 +157,8 @@  unsigned long tracecmd_get_flags(struct tracecmd_input *handle);
 unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle);
 int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
 			      unsigned long long trace_id,
-			      char **name,
-			      int *vcpu_count, int **cpu_pid);
+			      const char **name,
+			      int *vcpu_count, const int **cpu_pid);
 unsigned long long tracecmd_get_tsync_peer(struct tracecmd_input *handle);
 int tracecmd_enable_tsync(struct tracecmd_input *handle, bool enable);
 
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index faf6a795..c1531410 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -3695,8 +3695,8 @@  unsigned long long tracecmd_get_traceid(struct tracecmd_input *handle)
  */
 int tracecmd_get_guest_cpumap(struct tracecmd_input *handle,
 			      unsigned long long trace_id,
-			      char **name,
-			      int *vcpu_count, int **cpu_pid)
+			      const char **name,
+			      int *vcpu_count, const int **cpu_pid)
 {
 	struct guest_trace_info	*guest = handle->guest;