perf data: Fix error return code in perf_data__create_dir()
authorZhen Lei <thunder.leizhen@huawei.com>
Thu, 15 Apr 2021 08:34:16 +0000 (16:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 May 2021 09:04:31 +0000 (11:04 +0200)
commitb571a6302a64fd1d516a1843afc893f0dfdf23d5
tree509378ed7f18ee14d4dd74657b21bb380ac3dfd2
parent48ec949ac979b4b42d740f67b6177797af834f80
perf data: Fix error return code in perf_data__create_dir()

[ Upstream commit f2211881e737cade55e0ee07cf6a26d91a35a6fe ]

Although 'ret' has been initialized to -1, but it will be reassigned by
the "ret = open(...)" statement in the for loop. So that, the value of
'ret' is unknown when asprintf() failed.

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>
Link: http://lore.kernel.org/lkml/20210415083417.3740-1-thunder.leizhen@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/data.c