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-next>] [day] [month] [year] [list]
Date:   Thu, 9 Jun 2022 23:42:27 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     viro@...iv.linux.org.uk, ndesaulniers@...gle.com,
        nathan@...nel.org, jstitt007@...il.com, akpm@...ux-foundation.org
Subject: Re: +
 include-uapi-linux-swabh-move-explicit-cast-outside-ternary.patch added to
 mm-nonmm-unstable branch

On Thu, Jun 09, 2022 at 10:29:33AM -0700, Andrew Morton wrote:
> A cast inside __builtin_constant_p doesn't do anything since it should
> evaluate as constant at compile time irrespective of this cast.  Instead,
> I moved this cast outside the ternary to ensure the return type is as
> expected.

> --- a/include/uapi/linux/swab.h~include-uapi-linux-swabh-move-explicit-cast-outside-ternary
> +++ a/include/uapi/linux/swab.h
> @@ -102,7 +102,7 @@ static inline __attribute_const__ __u32
>  #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
>  #else
>  #define __swab16(x)				\
> -	(__builtin_constant_p((__u16)(x)) ?	\
> +	(__u16)(__builtin_constant_p(x) ?	\

This cast is necessary.

>  	___constant_swab16(x) :			\
>  	__fswab16(x))
>  #endif
> @@ -115,7 +115,7 @@ static inline __attribute_const__ __u32
>  #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
>  #else
>  #define __swab32(x)				\
> -	(__builtin_constant_p((__u32)(x)) ?	\
> +	(__u32)(__builtin_constant_p(x) ?	\
>  	___constant_swab32(x) :			\
>  	__fswab32(x))
>  #endif
> @@ -128,7 +128,7 @@ static inline __attribute_const__ __u32
>  #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
>  #else
>  #define __swab64(x)				\
> -	(__builtin_constant_p((__u64)(x)) ?	\
> +	(__u64)(__builtin_constant_p(x) ?	\
>  	___constant_swab64(x) :			\
>  	__fswab64(x))

These two aren't? typeof(c ? u32 : u32) is u32.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ