[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170601112931.GA15888@krava>
Date: Thu, 1 Jun 2017 13:29:31 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Jiri Olsa <jolsa@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, kernel-team@....com,
David Ahern <dsahern@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [PATCH 1/2] perf tools: Decompress kernel module when reading
DSO data
On Thu, Jun 01, 2017 at 06:06:04PM +0900, Namhyung Kim wrote:
SNIP
> @@ -399,6 +438,7 @@ static int __open_dso(struct dso *dso, struct machine *machine)
> int fd;
> char *root_dir = (char *)"";
> char *name = malloc(PATH_MAX);
> + bool needs_unlink = false;
>
> if (!name)
> return -ENOMEM;
> @@ -415,7 +455,23 @@ static int __open_dso(struct dso *dso, struct machine *machine)
> if (!is_regular_file(name))
> return -EINVAL;
>
> + if (dso__needs_decompress(dso)) {
> + char buf[32];
> +
> + fd = dso__decompress_kmodule(dso, name, buf, sizeof(buf));
> + if (fd < 0)
free(name)
> + return -1;
> +
> + close(fd);
> + strcpy(name, buf);
also why not use name directly instead of buf?
jirka
Powered by blists - more mailing lists