2010-02-25 02:58:32

by Yanmin Zhang

[permalink] [raw]
Subject: Check the right return variable

In function dso__split_kallsyms, curr_map saves the return value of
map__new2. So check it instead of var map after the calling returns.

Signed-off-by: Zhang Yanmin <[email protected]>

---

diff -Nraup linux-2.6.33/tools/perf/util/symbol.c linux-2.6.33_perf/tools/perf/util/symbol.c
--- linux-2.6.33/tools/perf/util/symbol.c 2010-02-25 02:52:17.000000000 +0800
+++ linux-2.6.33_perf/tools/perf/util/symbol.c 2010-02-25 10:12:33.000000000 +0800
@@ -503,7 +503,7 @@ static int dso__split_kallsyms(struct ds
return -1;

curr_map = map__new2(pos->start, dso, map->type);
- if (map == NULL) {
+ if (curr_map == NULL) {
dso__delete(dso);
return -1;
}


2010-02-25 08:46:19

by David Miller

[permalink] [raw]
Subject: Re: Check the right return variable

From: "Zhang, Yanmin" <[email protected]>
Date: Thu, 25 Feb 2010 11:00:51 +0800

> In function dso__split_kallsyms, curr_map saves the return value of
> map__new2. So check it instead of var map after the calling returns.
>
> Signed-off-by: Zhang Yanmin <[email protected]>

Acked-by: David S. Miller <[email protected]>

2010-02-25 11:19:15

by Yanmin Zhang

[permalink] [raw]
Subject: [tip:perf/core] perf symbols: Check the right return variable

Commit-ID: 37fe5fcb7a5b5235c8b71bf5469ce4c7246e3fab
Gitweb: http://git.kernel.org/tip/37fe5fcb7a5b5235c8b71bf5469ce4c7246e3fab
Author: Zhang, Yanmin <[email protected]>
AuthorDate: Thu, 25 Feb 2010 11:00:51 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Thu, 25 Feb 2010 12:15:24 +0100

perf symbols: Check the right return variable

In function dso__split_kallsyms(), curr_map saves the return value
of map__new2. So check it instead of var map after the call returns.

Signed-off-by: Zhang Yanmin <[email protected]>
Acked-by: David S. Miller <[email protected]>
Cc: <[email protected]> # for .33.x
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
LKML-Reference: <1267066851.1726.9.camel@localhost>
Signed-off-by: Ingo Molnar <[email protected]>
---
tools/perf/util/symbol.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ee9c37e..320b151 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -527,7 +527,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map,
return -1;

curr_map = map__new2(pos->start, dso, map->type);
- if (map == NULL) {
+ if (curr_map == NULL) {
dso__delete(dso);
return -1;
}