mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
perf map: Fix error return code in maps__clone()
Although 'err' has been initialized to -ENOMEM, but it will be reassigned
by the "err = unwind__prepare_access(...)" statement in the for loop. So
that, the value of 'err' is unknown when map__clone() failed.
Fixes: 6c50258443
("perf unwind: Call unwind__prepare_access for forked thread")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: zhen lei <thunder.leizhen@huawei.com>
Link: http://lore.kernel.org/lkml/20210415092744.3793-1-thunder.leizhen@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
671b60cb6a
commit
c6f8714125
1 changed files with 5 additions and 2 deletions
|
@ -840,15 +840,18 @@ int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp)
|
||||||
int maps__clone(struct thread *thread, struct maps *parent)
|
int maps__clone(struct thread *thread, struct maps *parent)
|
||||||
{
|
{
|
||||||
struct maps *maps = thread->maps;
|
struct maps *maps = thread->maps;
|
||||||
int err = -ENOMEM;
|
int err;
|
||||||
struct map *map;
|
struct map *map;
|
||||||
|
|
||||||
down_read(&parent->lock);
|
down_read(&parent->lock);
|
||||||
|
|
||||||
maps__for_each_entry(parent, map) {
|
maps__for_each_entry(parent, map) {
|
||||||
struct map *new = map__clone(map);
|
struct map *new = map__clone(map);
|
||||||
if (new == NULL)
|
|
||||||
|
if (new == NULL) {
|
||||||
|
err = -ENOMEM;
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
}
|
||||||
|
|
||||||
err = unwind__prepare_access(maps, new, NULL);
|
err = unwind__prepare_access(maps, new, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
Loading…
Reference in a new issue