From patchwork Fri Jan 12 18:08:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 10758467 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail.kernel.org ([198.145.29.99]:49922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964844AbeALSJc (ORCPT ); Fri, 12 Jan 2018 13:09:32 -0500 Message-Id: <20180112180930.345950960@goodmis.org> Date: Fri, 12 Jan 2018 13:08:48 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Cc: Vladislav Valtchev , Yordan Karadzhov Subject: [PATCH 1/3] trace-cmd: Fix leaking of port_array memory References: <20180112180847.372748598@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0001-trace-cmd-Fix-leaking-of-port_array-memory.patch Sender: linux-trace-devel-owner@vger.kernel.org List-ID: From: "Steven Rostedt (VMware)" The port_array is allocated in create_all_readers() to send the ports that are created to the client. But after it is sent, it is no longer needed, but it was not freed. This causes a memory leak. Signed-off-by: Steven Rostedt (VMware) --- trace-listen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trace-listen.c b/trace-listen.c index 38de59263800..871df0e7a04c 100644 --- a/trace-listen.c +++ b/trace-listen.c @@ -587,9 +587,11 @@ static int *create_all_readers(const char *node, const char *port, write(msg_handle->fd, "\0", 1); } + free(port_array); return pid_array; out_free: + free(port_array); destroy_all_readers(cpus, pid_array, node, port); return NULL; } From patchwork Fri Jan 12 18:08:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 10758471 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail.kernel.org ([198.145.29.99]:49926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965003AbeALSJc (ORCPT ); Fri, 12 Jan 2018 13:09:32 -0500 Message-Id: <20180112180930.472825624@goodmis.org> Date: Fri, 12 Jan 2018 13:08:49 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Cc: Vladislav Valtchev , Yordan Karadzhov Subject: [PATCH 2/3] trace-cmd msg: Set the min size of a message on init References: <20180112180847.372748598@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0002-trace-cmd-msg-Set-the-min-size-of-a-message-on-init.patch Sender: linux-trace-devel-owner@vger.kernel.org List-ID: From: "Steven Rostedt (VMware)" As there exist a map for the minimum sizes of messages, we can use that to set up the minimum size of messages during init of the msg_handle. Signed-off-by: Steven Rostedt (VMware) --- trace-msg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trace-msg.c b/trace-msg.c index 6f3d878a067f..8b87858f3f2b 100644 --- a/trace-msg.c +++ b/trace-msg.c @@ -255,7 +255,10 @@ static void tracecmd_msg_init(u32 cmd, struct tracecmd_msg *msg) { memset(msg, 0, sizeof(*msg)); msg->hdr.cmd = htonl(cmd); - msg->hdr.size = htonl(MSG_HDR_LEN); + if (!msg_min_sizes[cmd]) + msg->hdr.size = htonl(MSG_HDR_LEN); + else + msg->hdr.size = htonl(msg_min_sizes[cmd]); } static void msg_free(struct tracecmd_msg *msg) From patchwork Fri Jan 12 18:08:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 10758469 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail.kernel.org ([198.145.29.99]:49920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964988AbeALSJc (ORCPT ); Fri, 12 Jan 2018 13:09:32 -0500 Message-Id: <20180112180930.593490856@goodmis.org> Date: Fri, 12 Jan 2018 13:08:50 -0500 From: Steven Rostedt To: linux-trace-devel@vger.kernel.org Cc: Vladislav Valtchev , Yordan Karadzhov Subject: [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch References: <20180112180847.372748598@goodmis.org> MIME-Version: 1.0 Content-Disposition: inline; filename=0003-trace-cmd-TAGS-Fix-tags-to-not-parse-.pc-directory-o.patch Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1494 From: "Steven Rostedt (VMware)" When working on some code, I use quilt to develop to save off patchs to push and pop my current work. quilt will create a .pc directory to store the original files that are being worked on. Unfortunately, the current code that creates TAGS will decend into this directory and include it when doing code searching via emacs or vim. If one is not careful, they can end up editing the saved quilt original file and not the file they should be editing. Add a find_tag_files define that limits the scope of where TAGS will get its code to examine. Signed-off-by: Steven Rostedt (VMware) --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b7bb3cce1258..e620d578140b 100644 --- a/Makefile +++ b/Makefile @@ -537,17 +537,22 @@ show_gui_done: PHONY += show_gui_make +define find_tag_files + find . -name '\.pc' -prune -o -name '*\.[ch]' \ + ! -name '\.#' -print +endef + tags: force $(RM) tags - find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px + $(call find_tag_files) | xargs ctags --extra=+f --c-kinds=+px TAGS: force $(RM) TAGS - find . -name '*.[ch]' | xargs etags + $(call find_tag_files) | xargs etags cscope: force $(RM) cscope* - find . -name '*.[ch]' | cscope -b -q + $(call find_tag_files) | cscope -b -q PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS))