[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <mhng-07aca7a6-5b81-401d-9f0a-438fcd9aef43@palmer-si-x1e>
Date: Wed, 22 May 2019 12:06:29 -0700 (PDT)
From: Palmer Dabbelt <palmer@...ive.com>
To: mark.rutland@....com
CC: linux-kernel@...r.kernel.org, peterz@...radead.org,
Will Deacon <will.deacon@....com>, aou@...s.berkeley.edu,
Arnd Bergmann <arnd@...db.de>, bp@...en8.de,
catalin.marinas@....com, davem@...emloft.net, fenghua.yu@...el.com,
heiko.carstens@...ibm.com, herbert@...dor.apana.org.au,
ink@...assic.park.msu.ru, jhogan@...nel.org, linux@...linux.org.uk,
mark.rutland@....com, mattst88@...il.com, mingo@...nel.org,
mpe@...erman.id.au, paul.burton@...s.com, paulus@...ba.org,
ralf@...ux-mips.org, rth@...ddle.net, stable@...r.kernel.org,
tglx@...utronix.de, tony.luck@...el.com, vgupta@...opsys.com
Subject: Re: [PATCH 11/18] locking/atomic: riscv: fix atomic64_sub_if_positive() offset argument
On Wed, 22 May 2019 06:22:43 PDT (-0700), mark.rutland@....com wrote:
> Presently the riscv implementation of atomic64_sub_if_positive() takes
> a 32-bit offset value rather than a 64-bit offset value as it should do.
> Thus, if called with a 64-bit offset, the value will be unexpectedly
> truncated to 32 bits.
>
> Fix this by taking the offset as a long rather than an int.
>
> Signed-off-by: Mark Rutland <mark.rutland@....com>
> Cc: Albert Ou <aou@...s.berkeley.edu>
> Cc: Palmer Dabbelt <palmer@...ive.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Will Deacon <will.deacon@....com>
> Cc: stable@...r.kernel.org
> ---
> arch/riscv/include/asm/atomic.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/include/asm/atomic.h b/arch/riscv/include/asm/atomic.h
> index 93826771b616..c9e18289d65c 100644
> --- a/arch/riscv/include/asm/atomic.h
> +++ b/arch/riscv/include/asm/atomic.h
> @@ -336,7 +336,7 @@ static __always_inline int atomic_sub_if_positive(atomic_t *v, int offset)
> #define atomic_dec_if_positive(v) atomic_sub_if_positive(v, 1)
>
> #ifndef CONFIG_GENERIC_ATOMIC64
> -static __always_inline long atomic64_sub_if_positive(atomic64_t *v, int offset)
> +static __always_inline long atomic64_sub_if_positive(atomic64_t *v, long offset)
> {
> long prev, rc;
Reviewed-by: Palmer Dabbelt <palmer@...ive.com>
Thanks!
Powered by blists - more mailing lists