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]
Message-ID: <20180618155439.GD11612@arm.com>
Date:   Mon, 18 Jun 2018 16:54:40 +0100
From:   Will Deacon <will.deacon@....com>
To:     Mark Rutland <mark.rutland@....com>
Cc:     linux-kernel@...r.kernel.org, peterz@...radead.org,
        boqun.feng@...il.com, mingo@...nel.org,
        Richard Henderson <rth@...ddle.net>,
        Ivan Kokshaysky <ink@...assic.park.msu.ru>,
        Matt Turner <mattst88@...il.com>
Subject: Re: [PATCHv3 09/18] atomics/alpha: define atomic64_fetch_add_unless()

On Mon, Jun 18, 2018 at 11:19:10AM +0100, Mark Rutland wrote:
> As a step towards unifying the atomic/atomic64/atomic_long APIs, this
> patch converts the arch/alpha implementation of atomic64_add_unless() into
> an implementation of atomic64_fetch_add_unless().
> 
> A wrapper in <linux/atomic.h> will build atomic_add_unless() atop of
> this, provided it is given a preprocessor definition.
> 
> No functional change is intended as a result of this patch.
> 
> Signed-off-by: Mark Rutland <mark.rutland@....com>
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Cc: Boqun Feng <boqun.feng@...il.com>
> Cc: Will Deacon <will.deacon@....com>
> Cc: Richard Henderson <rth@...ddle.net>
> Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
> Cc: Matt Turner <mattst88@...il.com>
> ---
>  arch/alpha/include/asm/atomic.h | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
> index 4a800a3424a3..dcb7bbeeae02 100644
> --- a/arch/alpha/include/asm/atomic.h
> +++ b/arch/alpha/include/asm/atomic.h
> @@ -238,35 +238,36 @@ static __inline__ int atomic_fetch_add_unless(atomic_t *v, int a, int u)
>  #define atomic_fetch_add_unless atomic_fetch_add_unless
>  
>  /**
> - * atomic64_add_unless - add unless the number is a given value
> + * atomic64_fetch_add_unless - add unless the number is a given value
>   * @v: pointer of type atomic64_t
>   * @a: the amount to add to v...
>   * @u: ...unless v is equal to u.
>   *
>   * Atomically adds @a to @v, so long as it was not @u.
> - * Returns true iff @v was not @u.
> + * Returns the old value of @v.
>   */
> -static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
> +static __inline__ int atomic64_fetch_add_unless(atomic64_t *v, long a, long u)

Don't you want a 64-bit return type (e.g. long) here?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ