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] [day] [month] [year] [list]
Message-ID: <60996fd3604b403ab67e8f73854264ee@AcuMS.aculab.com>
Date:   Thu, 2 Mar 2023 16:40:00 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Arnd Bergmann' <arnd@...nel.org>, Will Deacon <will@...nel.org>,
        "Peter Zijlstra" <peterz@...radead.org>,
        Arnd Bergmann <arnd@...db.de>, Matt Evans <mev@...osinc.com>
CC:     Boqun Feng <boqun.feng@...il.com>,
        Mark Rutland <mark.rutland@....com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>
Subject: RE: [PATCH] asm-generic: avoid __generic_cmpxchg_local warnings

...
> I had another look at why the cast is even needed for atomic_cmpxchg(),
> and as Matt describes the problem here is that atomic_t contains a
> signed 'int', but cmpxchg() takes an 'unsigned long' argument, and
> converting between the two leads to a 64-bit sign-extension of
> negative 32-bit atomics.

How about:
	signed_var + 0u + 0ull;

Converts 32bit signed to 64bit unsigned without sign extension.
Compiler will throw it all away if not needed.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ