All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Will Deacon <will.deacon@arm.com>, torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Victor Kamensky <victor.kamensky@linaro.org>
Subject: Re: [PATCH] word-at-a-time: avoid undefined behaviour in zero_bytemask macro
Date: Wed, 30 Apr 2014 14:22:19 -0700	[thread overview]
Message-ID: <5361698B.4060607@zytor.com> (raw)
In-Reply-To: <1398271972-15177-1-git-send-email-will.deacon@arm.com>

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))

  reply	other threads:[~2014-04-30 21:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 16:52 [PATCH] word-at-a-time: avoid undefined behaviour in zero_bytemask macro Will Deacon
2014-04-30 21:22 ` H. Peter Anvin [this message]
2014-05-01  9:04   ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5361698B.4060607@zytor.com \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=victor.kamensky@linaro.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.