Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444AbdFOA31 (ORCPT ); Wed, 14 Jun 2017 20:29:27 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:57059 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbdFOA2f (ORCPT ); Wed, 14 Jun 2017 20:28:35 -0400 X-ME-Sender: X-Sasl-enc: fJkQbvGsuMqXiV5zgoN8a0yr2ALGXozzVgTM7+HkUita 1497486514 From: Michael Sartain To: Steven Rostedt Cc: Michael Sartain , linux-kernel@vger.kernel.org Subject: [PATCH v3 6/6] Fix cases where string literals were passed as string format args Date: Wed, 14 Jun 2017 18:28:01 -0600 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4097 Lines: 111 Signed-off-by: Michael Sartain --- trace-capture.c | 12 ++++++------ trace-dialog.c | 4 ++-- trace-filter.c | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/trace-capture.c b/trace-capture.c index 1acfe44..4e1392e 100644 --- a/trace-capture.c +++ b/trace-capture.c @@ -1019,7 +1019,7 @@ static void save_events(struct trace_capture *cap, tracecmd_xml_write_element(handle, "CaptureType", "Events"); for (i = 0; systems && systems[i]; i++) - tracecmd_xml_write_element(handle, "System", systems[i]); + tracecmd_xml_write_element(handle, "System", "%s", systems[i]); if (!events || events[0] < 0) return; @@ -1029,8 +1029,8 @@ static void save_events(struct trace_capture *cap, event = pevent_find_event(pevent, events[i]); if (event) { tracecmd_xml_start_sub_system(handle, "Event"); - tracecmd_xml_write_element(handle, "System", event->system); - tracecmd_xml_write_element(handle, "Name", event->name); + tracecmd_xml_write_element(handle, "System", "%s", event->system); + tracecmd_xml_write_element(handle, "Name", "%s", event->name); tracecmd_xml_end_sub_system(handle); } } @@ -1068,15 +1068,15 @@ static void save_settings(struct trace_capture *cap, const char *filename) update_plugin(cap); if (info->cap_plugin) - tracecmd_xml_write_element(handle, "Plugin", info->cap_plugin); + tracecmd_xml_write_element(handle, "Plugin", "%s", info->cap_plugin); command = gtk_entry_get_text(GTK_ENTRY(cap->command_entry)); if (command && strlen(command) && !is_just_ws(command)) - tracecmd_xml_write_element(handle, "Command", command); + tracecmd_xml_write_element(handle, "Command", "%s", command); file = gtk_entry_get_text(GTK_ENTRY(cap->file_entry)); if (file && strlen(file) && !is_just_ws(file)) - tracecmd_xml_write_element(handle, "File", file); + tracecmd_xml_write_element(handle, "File", "%s", file); tracecmd_xml_end_system(handle); diff --git a/trace-dialog.c b/trace-dialog.c index 5d3aabe..b5776cc 100644 --- a/trace-dialog.c +++ b/trace-dialog.c @@ -218,7 +218,7 @@ void warning(const char *fmt, ...) errno = 0; trace_dialog(GTK_WINDOW(parent_window), TRACE_GUI_WARNING, - str->str); + "%s", str->str); g_string_free(str, TRUE); } @@ -425,7 +425,7 @@ void trace_show_record_dialog(GtkWindow *parent, struct pevent *pevent, if (s.buffer_size) { trace_seq_terminate(&s); - trace_dialog(parent, TRACE_GUI_OTHER, s.buffer); + trace_dialog(parent, TRACE_GUI_OTHER, "%s", s.buffer); } trace_seq_destroy(&s); diff --git a/trace-filter.c b/trace-filter.c index 1c36d84..bd8cb11 100644 --- a/trace-filter.c +++ b/trace-filter.c @@ -2043,7 +2043,7 @@ int trace_filter_save_events(struct tracecmd_xml_handle *handle, &event_ids); for (i = 0; systems && systems[i]; i++) - tracecmd_xml_write_element(handle, "System", systems[i]); + tracecmd_xml_write_element(handle, "System", "%s", systems[i]); for (i = 0; event_ids && event_ids[i] > 0; i++) { str = pevent_filter_make_string(filter, event_ids[i]); @@ -2060,11 +2060,11 @@ int trace_filter_save_events(struct tracecmd_xml_handle *handle, } tracecmd_xml_start_sub_system(handle, "Event"); - tracecmd_xml_write_element(handle, "System", event->system); - tracecmd_xml_write_element(handle, "Name", event->name); + tracecmd_xml_write_element(handle, "System", "%s", event->system); + tracecmd_xml_write_element(handle, "Name", "%s", event->name); /* If this is has an advanced filter, include that too */ if (strcmp(str, "TRUE") != 0) { - tracecmd_xml_write_element(handle, "Advanced", + tracecmd_xml_write_element(handle, "Advanced", "%s", str); } tracecmd_xml_end_sub_system(handle); @@ -2088,7 +2088,7 @@ int trace_filter_save_tasks(struct tracecmd_xml_handle *handle, for (i = 0; pids[i] >= 0; i++) { snprintf(buffer, 100, "%d", pids[i]); - tracecmd_xml_write_element(handle, "Task", buffer); + tracecmd_xml_write_element(handle, "Task", "%s", buffer); } free(pids); -- 2.11.0