]> git.baikalelectronics.ru Git - kernel.git/commit
perf tools: Fix mmap2 event allocation in synthesize code
authorWang Nan <wangnan0@huawei.com>
Tue, 12 Jan 2016 10:12:04 +0000 (10:12 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 12 Jan 2016 14:24:43 +0000 (11:24 -0300)
commit1b9480c61b2dd4be247c2f12ac0dc691b951f9a2
treec6cd7445562342d75a2340163f1ae77e6c2fcbfc
parent62fdbd15ab764878abb62641ff230d11fa22528f
perf tools: Fix mmap2 event allocation in synthesize code

perf_event__synthesize_mmap_events() issues mmap2 events, but the memory
of that event is allocated using:

 mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size);

If path of mmap source file is long (near PATH_MAX), random crash would
happen. Should use sizeof(mmap_event->mmap2).

Fix two memory allocations.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1452593524-138970-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/event.c