Skip to contentSkip to conversation

perf: Handle NULL dso in dso__name_len

PATCH Applied David Miller 2 participants 3 messages Mar 25, 2012 – Mar 31, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 perf: Handle NULL dso in dso__name_len

We should use "[unknown]" in this case, in concert with the code in _hist_entry__dso_snprintf().

Otherwise we'll crash when recomputing the histogram column lengths in hists__calc_col_len().

---
 tools/perf/util/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +2 -0
index 5dd83c3..472b467 100644
@@ -51,6 +51,8 @@ struct symbol_conf symbol_conf = {
 
 int dso__name_len(const struct dso *dso)
 {
+	if (!dso)
+		return strlen("[unknown]");
 	if (verbose)
 		return dso->long_name_len;
 
Signature · 1 line
1.7.9.1
#1 lore raw

Em Sun, Mar 25, 2012 at 04:28:22PM -0400, David Miller escreveu:

Quoted 6 lines

We should use "[unknown]" in this case, in concert with the code in _hist_entry__dso_snprintf().

Otherwise we'll crash when recomputing the histogram column lengths in hists__calc_col_len().

Thanks, applied.

- Arnaldo

#2 lore raw

[tip:perf/urgent] perf symbols: Handle NULL dso in dso__name_len

In reply to David Miller
Commit-ID:  1e2dd2f73afdc810cc7400b7036232fbdc416eeb
Gitweb:     http://git.kernel.org/tip/1e2dd2f73afdc810cc7400b7036232fbdc416eeb
Author:     David Miller <[email protected]>
AuthorDate: Sun, 25 Mar 2012 16:28:22 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 27 Mar 2012 11:00:58 -0300

perf symbols: Handle NULL dso in dso__name_len

We should use "[unknown]" in this case, in concert with the code in _hist_entry__dso_snprintf().

Otherwise we'll crash when recomputing the histogram column lengths in hists__calc_col_len().

---
 tools/perf/util/symbol.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/symbol.c +2 -0
index d9e995b..c0a028c 100644
@@ -50,6 +50,8 @@ struct symbol_conf symbol_conf = {
 
 int dso__name_len(const struct dso *dso)
 {
+	if (!dso)
+		return strlen("[unknown]");
 	if (verbose)
 		return dso->long_name_len;