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] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2014 14:22:19 -0700
From:	"H. Peter Anvin" <hpa@...or.com>
To:	Will Deacon <will.deacon@....com>, torvalds@...ux-foundation.org
CC:	linux-kernel@...r.kernel.org, stable@...r.kernel.org,
	Victor Kamensky <victor.kamensky@...aro.org>
Subject: Re: [PATCH] word-at-a-time: avoid undefined behaviour in zero_bytemask
 macro

On 04/23/2014 09:52 AM, Will Deacon wrote:
> 
> diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h
> index d3909effd725..d96deb443f18 100644
> --- a/include/asm-generic/word-at-a-time.h
> +++ b/include/asm-generic/word-at-a-time.h
> @@ -50,11 +50,7 @@ static inline bool has_zero(unsigned long val, unsigned long *data, const struct
>  }
>  
>  #ifndef zero_bytemask
> -#ifdef CONFIG_64BIT
> -#define zero_bytemask(mask)	(~0ul << fls64(mask))
> -#else
> -#define zero_bytemask(mask)	(~0ul << fls(mask))
> -#endif /* CONFIG_64BIT */
> -#endif /* zero_bytemask */
> +#define zero_bytemask(mask) (~0ul << __fls(mask) << 1)
> +#endif
>  
>  #endif /* _ASM_WORD_AT_A_TIME_H */
> 

Why not:

#define zero_bytemask(mask) (~1ul << __fls(mask))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ