[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131014131335.GA11175@ghostprotocols.net>
Date: Mon, 14 Oct 2013 10:13:35 -0300
From: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
Namhyung Kim <namhyung@...il.com>,
Paul Mackerras <paulus@...ba.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH V7 5/7] perf buildid-cache: add ability to add kcore to
the cache
Em Mon, Oct 14, 2013 at 01:43:42PM +0300, Adrian Hunter escreveu:
> +static int kcore_copy__compare_fds(int from, int to)
<SNIP>
> + while (1) {
> + /* Use read because mmap won't work on proc files */
> + ret = read(from, buf_from, page_size);
> + if (ret < 0)
> + return -1;
> + if (!ret)
> + return 0;
> + n = ret;
> + len = ret;
> + while (n) {
> + ret = read(to, buf_to, n);
> + if (ret <= 0)
> + return -1;
> + n -= ret;
You can't go on potentially rewriting 'buf_to' like that, consider using
readn().
> + }
> +
> + if (memcmp(buf_from, buf_to, len))
> + return -1;
> + }
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists