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


Groups > linux.kernel > #1390614 > unrolled thread

Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions

Started byMasami Hiramatsu <mhiramat@kernel.org>
First post2016-04-29 01:20 +0200
Last post2016-04-29 01:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to  cache the probe definitions Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 01:20 +0200

#1390614 — Re: [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2016-04-29 01:20 +0200
SubjectRe: [PATCH perf/core v5 04/15] perf probe: Add --cache option to cache the probe definitions
Message-ID<rt3nX-3WT-1@gated-at.bofh.it>
On Thu, 28 Apr 2016 11:12:19 +0900
Namhyung Kim <namhyung@kernel.org> wrote:

> On Thu, Apr 28, 2016 at 03:37:42AM +0900, Masami Hiramatsu wrote:
> > From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > 
> > Add --cache option to cache the probe definitions. This
> > just saves the result of the dwarf analysis to probe cache.
> > 
> > Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> > ---
> >  Changes in v5:
> >   - Move probe_cache* definitions. (code cleanup)
> > 
> >  Changes in v4:
> >   - Remove cache saving failure message.
> > ---
> 
> [snip]
> > +static int probe_cache__load(struct probe_cache *pcache)
> > +{
> > +	struct probe_cache_entry *entry = NULL;
> > +	char buf[MAX_CMDLEN], *p;
> > +	int ret = 0;
> > +	FILE *fp;
> > +
> > +	fp = fdopen(dup(pcache->fd), "r");
> > +	while (!feof(fp)) {
> > +		if (!fgets(buf, MAX_CMDLEN, fp))
> > +			break;
> > +		p = strchr(buf, '\n');
> > +		if (p)
> > +			*p = '\0';
> > +		if (buf[0] == '#') {	/* #perf_probe_event */
> > +			entry = probe_cache_entry__new(NULL);
> 
> The probe_cache_entry__new() can fail.

Good catch!

> 
> Thanks,
> Namhyung
> 
> 
> > +			entry->spev = strdup(buf + 1);

Moreover, if this strdup fail, this goes to return but retvalue is 0...

I'll fix this too.

Thank you!

-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web