Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp472937ybm; Wed, 22 May 2019 06:27:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCb6iyhbr9DR59RD1vhijNNYwvxNSVtR9L5xHDMnOw5koLIFVsEGkRa32XPpTz6u9fbriu X-Received: by 2002:a65:60c7:: with SMTP id r7mr87920971pgv.22.1558531675161; Wed, 22 May 2019 06:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558531675; cv=none; d=google.com; s=arc-20160816; b=MdsfcLvFU4w1XUqBWpxeOgPNJOe9kdh3lUCZRrZ61rF43q2bXKpCVzlNISFNsq0AYG K7Yv/M0uRAvVI9SyFrwIaveFD3KA4JOSGDAH7TPW+bfei08ki9JPPlKRN3ex+20UR0My q52OnaTSUIZ9IM+LRg02QWpPyKMZkH6CRGYbmEzsJlg2Z7QlMqs2AApqRh919f+3s83W EYJX4++1Cium6ybL7d0VWoNUBI+tCSKCerdoz2BpW1Lv+2m9GvKVsHw3fnbkIcN4NqM4 6/ZEfFNKQuLyOXYEet4oY08cvkqUifZekAsDTbyL5r81+2H1aMtnixpgiZmEXIJgmjmB 0dAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Y3a3DtL5vxb30QvjeCe0BFxibn7kZxuICtdDZY9FYmY=; b=U5No/1W3dESCg2mYgsYY6iUssGtQBRPqU6r1yhT6L6GfwSzBmF2FBPy9kxOUrIrrpm kIqHzCa82yw3XPLXRGUSMijOep0X/O4peqbkomINNZ5kmIp13WVur3VSErBoZqgZ9YaT Ob8rdsqXTThSt1eWEO5Vz6gLh9+cA9OiMyYdzyrdFHfC3C+8vvvJ3KhGpZOYFh/0qQkJ T7GM3y+mqbpNXhrrRqdcB2IOZWpumc52URK1c92SRS6XmarWaFvRNZkGUVQx64lSXk27 ygMjenvP7wtDm46vHzMeQrFpRv9s2RQliB+kYFyGAx/mDv7cp2XLi3vPgy8mXDiy+XMm fBmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si20155565plr.137.2019.05.22.06.27.40; Wed, 22 May 2019 06:27:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729669AbfEVNZD (ORCPT + 99 others); Wed, 22 May 2019 09:25:03 -0400 Received: from foss.arm.com ([217.140.101.70]:51026 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbfEVNZD (ORCPT ); Wed, 22 May 2019 09:25:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EC72715AB; Wed, 22 May 2019 06:25:02 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A32BB3F575; Wed, 22 May 2019 06:24:58 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org, peterz@infradead.org, will.deacon@arm.com Cc: aou@eecs.berkeley.edu, arnd@arndb.de, bp@alien8.de, catalin.marinas@arm.com, davem@davemloft.net, fenghua.yu@intel.com, heiko.carstens@de.ibm.com, herbert@gondor.apana.org.au, ink@jurassic.park.msu.ru, jhogan@kernel.org, linux@armlinux.org.uk, mark.rutland@arm.com, mattst88@gmail.com, mingo@kernel.org, mpe@ellerman.id.au, palmer@sifive.com, paul.burton@mips.com, paulus@samba.org, ralf@linux-mips.org, rth@twiddle.net, stable@vger.kernel.org, tglx@linutronix.de, tony.luck@intel.com, vgupta@synopsys.com Subject: [PATCH 11/18] locking/atomic: riscv: fix atomic64_sub_if_positive() offset argument Date: Wed, 22 May 2019 14:22:43 +0100 Message-Id: <20190522132250.26499-12-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190522132250.26499-1-mark.rutland@arm.com> References: <20190522132250.26499-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Albert Ou Cc: Palmer Dabbelt Cc: Peter Zijlstra Cc: Will Deacon Cc: stable@vger.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; -- 2.11.0