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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 28 Oct 2019 16:39:30 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 2/6] perf dso: Refactor dso_cache__read()

On Fri, Oct 25, 2019 at 03:59:56PM +0300, Adrian Hunter wrote:

SNIP

> +}
>  
> -	return ret;
> +static struct dso_cache *dso_cache__find(struct dso *dso,
> +					 struct machine *machine,
> +					 u64 offset,
> +					 ssize_t *ret)
> +{
> +	struct dso_cache *cache = __dso_cache__find(dso, offset);
> +
> +	return cache ? cache : dso_cache__populate(dso, machine, offset, ret);
>  }
>  
>  static ssize_t dso_cache_read(struct dso *dso, struct machine *machine,
>  			      u64 offset, u8 *data, ssize_t size)
>  {
>  	struct dso_cache *cache;
> +	ssize_t ret = 0;
>  
> -	cache = dso_cache__find(dso, offset);
> -	if (cache)
> -		return dso_cache__memcpy(cache, offset, data, size);
> -	else
> -		return dso_cache__read(dso, machine, offset, data, size);
> +	cache = dso_cache__find(dso, machine, offset, &ret);
> +	if (!cache)
> +		return ret;

why not use the ERR_* macros to get error through the pointer
instead of adding extra argument?

jirka


> +
> +	return dso_cache__memcpy(cache, offset, data, size);
>  }
>  
>  /*
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ