linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] trace-cmd: A few fixes
@ 2018-01-12 18:08 Steven Rostedt
  2018-01-12 18:08 ` [PATCH 1/3] trace-cmd: Fix leaking of port_array memory Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-01-12 18:08 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Vladislav Valtchev, Yordan Karadzhov

Some updates for trace-cmd

Steven Rostedt (VMware) (3):
      trace-cmd: Fix leaking of port_array memory
      trace-cmd msg: Set the min size of a message on init
      trace-cmd TAGS: Fix tags to not parse .pc directory of patch

----
 Makefile       | 11 ++++++++---
 trace-listen.c |  2 ++
 trace-msg.c    |  5 ++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] trace-cmd: Fix leaking of port_array memory
  2018-01-12 18:08 [PATCH 0/3] trace-cmd: A few fixes Steven Rostedt
@ 2018-01-12 18:08 ` Steven Rostedt
  2018-01-12 18:08 ` [PATCH 2/3] trace-cmd msg: Set the min size of a message on init Steven Rostedt
  2018-01-12 18:08 ` [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-01-12 18:08 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Vladislav Valtchev, Yordan Karadzhov

[-- Attachment #1: 0001-trace-cmd-Fix-leaking-of-port_array-memory.patch --]
[-- Type: text/plain, Size: 786 bytes --]

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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) <rostedt@goodmis.org>
---
 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;
 }
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] trace-cmd msg: Set the min size of a message on init
  2018-01-12 18:08 [PATCH 0/3] trace-cmd: A few fixes Steven Rostedt
  2018-01-12 18:08 ` [PATCH 1/3] trace-cmd: Fix leaking of port_array memory Steven Rostedt
@ 2018-01-12 18:08 ` Steven Rostedt
  2018-01-12 18:08 ` [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-01-12 18:08 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Vladislav Valtchev, Yordan Karadzhov

[-- Attachment #1: 0002-trace-cmd-msg-Set-the-min-size-of-a-message-on-init.patch --]
[-- Type: text/plain, Size: 821 bytes --]

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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) <rostedt@goodmis.org>
---
 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)
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch
  2018-01-12 18:08 [PATCH 0/3] trace-cmd: A few fixes Steven Rostedt
  2018-01-12 18:08 ` [PATCH 1/3] trace-cmd: Fix leaking of port_array memory Steven Rostedt
  2018-01-12 18:08 ` [PATCH 2/3] trace-cmd msg: Set the min size of a message on init Steven Rostedt
@ 2018-01-12 18:08 ` Steven Rostedt
  2 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2018-01-12 18:08 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Vladislav Valtchev, Yordan Karadzhov

[-- Attachment #1: 0003-trace-cmd-TAGS-Fix-tags-to-not-parse-.pc-directory-o.patch --]
[-- Type: text/plain, Size: 1493 bytes --]

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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) <rostedt@goodmis.org>
---
 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))
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-12 18:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 18:08 [PATCH 0/3] trace-cmd: A few fixes Steven Rostedt
2018-01-12 18:08 ` [PATCH 1/3] trace-cmd: Fix leaking of port_array memory Steven Rostedt
2018-01-12 18:08 ` [PATCH 2/3] trace-cmd msg: Set the min size of a message on init Steven Rostedt
2018-01-12 18:08 ` [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).