]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
perf cpumap: Fix writing to illegal memory in handling cpumap mask
authorHe Zhe <zhe.he@windriver.com>
Fri, 2 Aug 2019 08:29:52 +0000 (16:29 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
commit61490b7c7fa9df96383ddaf5decde92bf527035b
tree8d11e5df056ebbbc22c7de10b99bb628857ff02b
parentbbbbf00fd21c9743e97a993236185d52d919bf3d
perf cpumap: Fix writing to illegal memory in handling cpumap mask

BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit 5f5e25f1c7933a6e1673515c0b1d5acd82fea1ed ]

cpu_map__snprint_mask() would write to illegal memory pointed by
zalloc(0) when there is only one cpu.

This patch fixes the calculation and adds sanity check against the input
parameters.

Signed-off-by: He Zhe <zhe.he@windriver.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Fixes: 4400ac8a9a90 ("perf cpumap: Introduce cpu_map__snprint_mask()")
Link: http://lkml.kernel.org/r/1564734592-15624-2-git-send-email-zhe.he@windriver.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
tools/perf/util/cpumap.c