Skip to contentSkip to conversation

perf machine: Pass correct string to dso__adjust_kmod_long_name

PATCH RESEND In review Wang Nan 3 participants 3 messages Dec 7, 2015 – Dec 8, 2015 perf events

lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH RESEND 1/1 perf machine: Pass correct string to dso__adjust_kmod_long_name

There's a mistake in dso__adjust_kmod_long_name() that, it use strdup() to dup the new long_name of a dso, but passes the original string to dso__set_long_name(). Which causes random crash during cleanup.

Fixes c03d5184f0e9("perf machine: Adjust dso->long_name for offline module")
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Zefan Li <[email protected]>
---
 tools/perf/util/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/machine.c +1 -1
index 95a7f60..bfc289c 100644
@@ -576,7 +576,7 @@ static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename)
 	if (!dup_filename)
 		return;
 
-	dso__set_long_name(dso, filename, true);
+	dso__set_long_name(dso, dup_filename, true);
 }
 
 struct map *machine__findnew_module_map(struct machine *machine, u64 start,
Signature · 1 line
1.8.3.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines

From: Wang Nan [mailto:[email protected]]

There's a mistake in dso__adjust_kmod_long_name() that, it use strdup() to dup the new long_name of a dso, but passes the original string to dso__set_long_name(). Which causes random crash during cleanup.

Looks good to me:)

Thanks!

Quoted 25 lines
Fixes c03d5184f0e9("perf machine: Adjust dso->long_name for offline module")
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Zefan Li <[email protected]>

---
tools/perf/util/machine.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/machine.c +1 -2
index 95a7f60..bfc289c 100644
@@ -576,7 +576,7 @@ static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename)
 	if (!dup_filename)
 		return;
 
-	dso__set_long_name(dso, filename, true);
+	dso__set_long_name(dso, dup_filename, true);
 }
 
 struct map *machine__findnew_module_map(struct machine *machine, u64 start,
--
Quoted 1 line

1.8.3.4

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#2 lore raw
In reply to Wang Nan
perf machine: Pass correct string to dso__adjust_kmod_long_name
Commit-ID:  5dcf16df3ce48b2e4f798b1a11b5de2fc3cfd73a
Gitweb:     http://git.kernel.org/tip/5dcf16df3ce48b2e4f798b1a11b5de2fc3cfd73a
Author:     Wang Nan <[email protected]>
AuthorDate: Mon, 7 Dec 2015 02:36:25 +0000
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 7 Dec 2015 18:12:45 -0300

perf machine: Pass correct string to dso__adjust_kmod_long_name

There's a mistake in dso__adjust_kmod_long_name() that it use strdup() to dup the new long_name of a dso, but passes the original string to dso__set_long_name(). Which causes random crash during cleanup.

Cc Namhyung Kim <[email protected]>
Cc Zefan Li <[email protected]>
Fixes c03d5184f0e9 ("perf machine: Adjust dso->long_name for offline module")
---
 tools/perf/util/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/machine.c +1 -1
index 95a7f60..bfc289c 100644
@@ -576,7 +576,7 @@ static void dso__adjust_kmod_long_name(struct dso *dso, const char *filename)
 	if (!dup_filename)
 		return;
 
-	dso__set_long_name(dso, filename, true);
+	dso__set_long_name(dso, dup_filename, true);
 }
 
 struct map *machine__findnew_module_map(struct machine *machine, u64 start,