Re: [PATCH] perf tools: Fix mmap2 event allocation in synthesize code

From: Jiri Olsa
Date: Wed Jan 06 2016 - 06:16:05 EST


On Wed, Jan 06, 2016 at 03:41:23AM +0000, Wang Nan wrote:
> 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 and rename all mmap_event to mmap2_event
> to make it clear.

nice one..

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/