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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 17 May 2021 08:31:12 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Nathan Chancellor' <nathan@...nel.org>,
        Arnd Bergmann <arnd@...nel.org>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Hans de Goede <hdegoede@...hat.com>
CC:     Arnd Bergmann <arnd@...db.de>,
        "platform-driver-x86@...r.kernel.org" 
        <platform-driver-x86@...r.kernel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "clang-built-linux@...glegroups.com" 
        <clang-built-linux@...glegroups.com>
Subject: RE: [PATCH] [v2] platform/surface: aggregator: avoid clang
 -Wconstant-conversion warning

From: Nathan Chancellor
> Sent: 14 May 2021 22:23
> >
> > Clang complains about the assignment of SSAM_ANY_IID to
> > ssam_device_uid->instance:

Has this been raised with clang?

...
> > -	.target   = ((tid) != SSAM_ANY_TID) ? (tid) : 0,			\
> > -	.instance = ((iid) != SSAM_ANY_IID) ? (iid) : 0,			\
> > -	.function = ((fun) != SSAM_ANY_FUN) ? (fun) : 0				\
> > +	.target   = __builtin_choose_expr((tid) != SSAM_ANY_TID, (tid), 0),	\
> > +	.instance = __builtin_choose_expr((iid) != SSAM_ANY_IID, (iid), 0),	\
> > +	.function = __builtin_choose_expr((fun) != SSAM_ANY_FUN, (fun), 0)

A simpler alternative:
		= fun * (fun != SSAM_ANY_FUN)

	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