[CRIU] [PATCH] bitops: use the UL literal for constants

Andrei Vagin avagin at virtuozzo.com
Mon Jun 18 21:00:06 MSK 2018


Applied

On Sun, Jun 17, 2018 at 06:44:42AM +0300, Andrei Vagin wrote:
> We operate by long variables in out bit arithmetics, so our constants
> should be marked as long too.
> 
> Cc: Adrian Reber <areber at redhat.com>
> Reported-by: Adrian Reber <areber at redhat.com>
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
>  include/common/asm-generic/bitops.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/common/asm-generic/bitops.h b/include/common/asm-generic/bitops.h
> index e1a097511..0d861bdcc 100644
> --- a/include/common/asm-generic/bitops.h
> +++ b/include/common/asm-generic/bitops.h
> @@ -28,25 +28,25 @@
>  
>  static inline void set_bit(int nr, volatile unsigned long *addr) {
>  	addr += nr / BITS_PER_LONG;
> -	*addr |= (1 << (nr % BITS_PER_LONG));
> +	*addr |= (1UL << (nr % BITS_PER_LONG));
>  }
>  
>  static inline void change_bit(int nr, volatile unsigned long *addr)
>  {
>  	addr += nr / BITS_PER_LONG;
> -	*addr ^= (1 << (nr % BITS_PER_LONG));
> +	*addr ^= (1UL << (nr % BITS_PER_LONG));
>  }
>  
>  static inline int test_bit(int nr, volatile const unsigned long *addr)
>  {
>  	addr += nr / BITS_PER_LONG;
> -	return (*addr & (1 << (nr % BITS_PER_LONG))) ? -1 : 0;
> +	return (*addr & (1UL << (nr % BITS_PER_LONG))) ? -1 : 0;
>  }
>  
>  static inline void clear_bit(int nr, volatile unsigned long *addr)
>  {
>  	addr += nr / BITS_PER_LONG;
> -	*addr &= ~(1 << (nr % BITS_PER_LONG));
> +	*addr &= ~(1UL << (nr % BITS_PER_LONG));
>  }
>  
>  /**
> -- 
> 2.14.3
> 


More information about the CRIU mailing list