>From bfc2eb1ac844b6d5f64e36eb01464a1cfba39663 Mon Sep 17 00:00:00 2001
From: Jovi Zhang <bookj...@gmail.com>
Date: Wed, 11 Jul 2012 04:32:15 +0800
Subject: [PATCH] perf: fix perf-report display ip string incorrectly

This patch fix perf ui browser cannot display ip string correctly
when using perf-report.

"char ipstr[BITS_PER_LONG / 4 + 1]" cannot reserve enough space
for ip string, for example string 0x80049ede need 13 bytes,
so change it to "BITS_PER_LONG / 4 + 3".

Signed-off-by: Jovi Zhang <bookj...@gmail.com>
---
 tools/perf/ui/browsers/hists.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 53f6697..a17c9c7 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -386,6 +386,8 @@ static char *callchain_list__sym_name(struct
callchain_list *cl,

 #define LEVEL_OFFSET_STEP 3

+#define IPSTR_LEN (BITS_PER_LONG / 4 + 3)
+
 static int hist_browser__show_callchain_node_rb_tree(struct
hist_browser *browser,
                                                     struct callchain_node 
*chain_node,
                                                     u64 total, int level,
@@ -416,7 +418,7 @@ static int
hist_browser__show_callchain_node_rb_tree(struct hist_browser *browse
                remaining -= cumul;

                list_for_each_entry(chain, &child->val, list) {
-                       char ipstr[BITS_PER_LONG / 4 + 1], *alloc_str;
+                       char ipstr[IPSTR_LEN], *alloc_str;
                        const char *str;
                        int color;
                        bool was_first = first;
@@ -492,7 +494,7 @@ static int
hist_browser__show_callchain_node(struct hist_browser *browser,
        char folded_sign = ' ';

        list_for_each_entry(chain, &node->val, list) {
-               char ipstr[BITS_PER_LONG / 4 + 1], *s;
+               char ipstr[IPSTR_LEN], *s;
                int color;

                folded_sign = callchain_list__folded(chain);
-- 
1.7.9.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to