Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665110

Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 15/16] perf tools: add feature header record to pipe-mode
Date 2017-06-13 21:00 +0200
Message-ID <tRZcK-380-11@gated-at.bofh.it> (permalink)
References <tRLMt-3kB-3@gated-at.bofh.it> <tRLMt-3kB-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jun 12, 2017 at 09:29:31PM -0700, David Carrillo-Cisneros wrote:

SNIP

>  
>  void perf_event__print_totals(void);
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index ddfaf157913d..6f6a54c15cb0 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -34,6 +34,7 @@
>  #include "data.h"
>  #include <api/fs/fs.h>
>  #include "asm/bug.h"
> +#include "tool.h"
>  
>  #include "sane_ctype.h"
>  
> @@ -97,11 +98,14 @@ static int __do_write_buf(struct feat_fd *ff,  const void *buf, size_t size)
>  
>  retry:
>  	if (size > (ff->size - ff->offset)) {
> -		addr = realloc(ff->buf, ff->size << 1);
> +		size = ff->size << 1;
> +		if (size > page_size)

event size could be 0xffff - sizeof(struct perf_event_header)
also the initial size is most likely > page_size anyway

please put this into the patch that introduced __do_write_buf

jirka

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 15/16] perf tools: add feature header record to pipe-mode David Carrillo-Cisneros <davidcc@google.com> - 2017-06-13 06:40 +0200
  Re: [PATCH v4 15/16] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-06-13 21:00 +0200
  Re: [PATCH v4 15/16] perf tools: add feature header record to  pipe-mode Jiri Olsa <jolsa@redhat.com> - 2017-06-13 21:00 +0200

csiph-web