lkml.org 
[lkml]   [2013]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> + }
> +}


\
 
 \ /
  Last update: 2013-10-14 15:41    [W:0.097 / U:0.892 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site