[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a55d3d15-d89d-43c4-85e7-c6d18a57a32f@app.fastmail.com>
Date: Fri, 03 Feb 2023 15:32:28 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Matt Evans" <mev@...osinc.com>, linux-kernel@...r.kernel.org,
Linux-Arch <linux-arch@...r.kernel.org>
Cc: "Palmer Dabbelt" <palmer@...osinc.com>
Subject: Re: [PATCH] locking/atomic: cmpxchg: Make __generic_cmpxchg_local compare
against zero-extended 'old' value
On Wed, Feb 1, 2023, at 19:39, Matt Evans wrote:
> __generic_cmpxchg_local takes unsigned long old/new arguments which
> might end up being up-cast from smaller signed types (which will
> sign-extend). The loaded compare value must be compared against a
> truncated smaller type, so down-cast appropriately for each size.
>
> The issue is apparent on 64-bit machines with code, such as
> atomic_dec_unless_positive(), that sign-extends from int.
>
> 64-bit machines generally don't use the generic cmpxchg but
> development/early ports might make use of it, so make it correct.
>
> Signed-off-by: Matt Evans <mev@...osinc.com>
> ---
Applied to the asm-generic tree for 6.3, thanks
Arnd
Powered by blists - more mailing lists