[linux-tools] 05/06: linux-perf: Fix use of uninitialized variables
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sun Mar 20 21:27:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository linux-tools.
commit fd89731014ea14efd990ae39a2c3b5a5a8678bb1
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Sun Mar 20 21:20:16 2016 +0000
linux-perf: Fix use of uninitialized variables
---
debian/changelog | 3 +
debian/patches/series | 1 +
...vent-fix-use-of-uninitialized-variables.patches | 69 ++++++++++++++++++++++
3 files changed, 73 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index b6602c1..f6f85ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ linux-tools (4.5-1~exp1) UNRELEASED; urgency=medium
* New upstream release
+ [ Ben Hutchings ]
+ * linux-perf: Fix use of uninitialized variables
+
-- Ben Hutchings <ben at decadent.org.uk> Sun, 20 Mar 2016 15:31:39 +0000
linux-tools (4.5~rc7-1~exp1) experimental; urgency=medium
diff --git a/debian/patches/series b/debian/patches/series
index 57f129f..c78eff8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -20,3 +20,4 @@ revert-perf-tools-x86-build-perf-on-older-user-space.patch
lockdep-add-missing-macros.patch
tools-build-remove-bpf-run-time-check-at-build-time.patch
power-cpupower-fix-manpages-NAME.patch
+tools-lib-traceevent-fix-use-of-uninitialized-variables.patches
diff --git a/debian/patches/tools-lib-traceevent-fix-use-of-uninitialized-variables.patches b/debian/patches/tools-lib-traceevent-fix-use-of-uninitialized-variables.patches
new file mode 100644
index 0000000..82a8418
--- /dev/null
+++ b/debian/patches/tools-lib-traceevent-fix-use-of-uninitialized-variables.patches
@@ -0,0 +1,69 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Sun, 20 Mar 2016 21:09:02 +0000
+Subject: tools lib traceevent: Fix use of uninitialized variables
+
+Fix a number of correct warnings from gcc:
+
+> plugin_function.c:133:6: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
+> int index;
+> ^
+
+'index' is initialized only if indentation is wanted. Move the
+printing of indentation using 'index' into the same if-statement.
+
+> kbuffer-parse.c:339:27: warning: 'length' may be used uninitialized in this function [-Wmaybe-uninitialized]
+> kbuf->next = kbuf->index + length;
+> ^
+> kbuffer-parse.c:297:15: note: 'length' was declared here
+> unsigned int length;
+> ^
+
+'length' is not initialized when handling an OLD_RINGBUF_TYPE_TIME_EXTEND
+record. Based on what trace-cmd does, set length = 0 in this case.
+
+> kbuffer-parse.c: In function 'kbuffer_read_at_offset':
+> kbuffer-parse.c:632:9: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
+> return data;
+> ^
+
+'data' is not initialized if the offset is too small. Initialize it
+to NULL so that the behaviour is the same as when the offset is too
+large.
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+--- a/tools/lib/traceevent/kbuffer-parse.c
++++ b/tools/lib/traceevent/kbuffer-parse.c
+@@ -314,6 +314,7 @@ static unsigned int old_update_pointers(
+ extend <<= TS_SHIFT;
+ extend += delta;
+ delta = extend;
++ length = 0;
+ ptr += 4;
+ break;
+
+@@ -613,7 +614,7 @@ unsigned long long kbuffer_timestamp(str
+ void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset,
+ unsigned long long *ts)
+ {
+- void *data;
++ void *data = NULL;
+
+ if (offset < kbuf->start)
+ offset = 0;
+--- a/tools/lib/traceevent/plugin_function.c
++++ b/tools/lib/traceevent/plugin_function.c
+@@ -142,10 +142,10 @@ static int function_handler(struct trace
+
+ parent = pevent_find_function(pevent, pfunction);
+
+- if (parent && ftrace_indent->set)
++ if (parent && ftrace_indent->set) {
+ index = add_and_get_index(parent, func, record->cpu);
+-
+- trace_seq_printf(s, "%*s", index*3, "");
++ trace_seq_printf(s, "%*s", index*3, "");
++ }
+
+ if (func)
+ trace_seq_printf(s, "%s", func);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-tools.git
More information about the Kernel-svn-changes
mailing list