lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 May 2017 00:35:56 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     David Carrillo-Cisneros <davidcc@...gle.com>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Andi Kleen <ak@...ux.intel.com>, Simon Que <sque@...omium.org>,
        Wang Nan <wangnan0@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
        He Kuang <hekuang@...wei.com>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        David Ahern <dsa@...ulusnetworks.com>,
        Stephane Eranian <eranian@...gle.com>,
        Paul Turner <pjt@...gle.com>, kernel-team@....com
Subject: Re: [PATCH v2 01/13] perf header: encapsulate read and swap

On Tue, May 23, 2017 at 12:48:41AM -0700, David Carrillo-Cisneros wrote:
> Most callers of readn in perf header read either a 32 or a 64 bits
> number, error check it and swap it, if necessary.
> 
> Create do_read_u32 and do_read_u64 to simplify this usage.
> 
> Signed-off-by: David Carrillo-Cisneros <davidcc@...gle.com>
> ---
>  tools/perf/util/header.c | 212 +++++++++++++++++------------------------------
>  1 file changed, 76 insertions(+), 136 deletions(-)
> 
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 948b2c5efb65..1dd4dbe13f88 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -117,27 +117,56 @@ static int do_write_string(int fd, const char *str)
>  	return write_padded(fd, str, olen, len);
>  }
>  
> +static int __do_read(int fd, void *addr, ssize_t size)
> +{
> +	ssize_t ret = readn(fd, addr, size);
> +
> +	if (ret != (ssize_t)size)

The 'size' is already ssize_t.

Thanks,
Namhyung


> +		return ret < 0 ? (int)ret : -1;
> +	return 0;
> +}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ