Re: [PATCH v3 kvmtool 02/13] sizes.h: Make all sizes 64bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 25 May 2022 12:23:34 +0100
Alexandru Elisei <alexandru.elisei@xxxxxxx> wrote:

Hi,

> Append ULL to all of the size definitions to make them 64bit and avoid
> overflows.

I am not fully convinced this is the best solution, as it deviates from
the kernel file, and just papers over issues at the call sites. I
acknowledge the pragmatic approach of trying to fix multiple problems at
once, but am wondering if we should use -fsanitize=undefined to identify
problematic code and fix it (I started doing this, actually).

Cheers,
Andre

> Reported-by: Andre Przywara <andre.przywara@xxxxxxx>
> Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx>
> ---
>  include/linux/sizes.h | 64 +++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> diff --git a/include/linux/sizes.h b/include/linux/sizes.h
> index ce3e8150c174..b2b5c457cf1c 100644
> --- a/include/linux/sizes.h
> +++ b/include/linux/sizes.h
> @@ -8,40 +8,40 @@
>  #ifndef __LINUX_SIZES_H__
>  #define __LINUX_SIZES_H__
>  
> -#define SZ_1				0x00000001
> -#define SZ_2				0x00000002
> -#define SZ_4				0x00000004
> -#define SZ_8				0x00000008
> -#define SZ_16				0x00000010
> -#define SZ_32				0x00000020
> -#define SZ_64				0x00000040
> -#define SZ_128				0x00000080
> -#define SZ_256				0x00000100
> -#define SZ_512				0x00000200
> +#define SZ_1				0x00000001ULL
> +#define SZ_2				0x00000002ULL
> +#define SZ_4				0x00000004ULL
> +#define SZ_8				0x00000008ULL
> +#define SZ_16				0x00000010ULL
> +#define SZ_32				0x00000020ULL
> +#define SZ_64				0x00000040ULL
> +#define SZ_128				0x00000080ULL
> +#define SZ_256				0x00000100ULL
> +#define SZ_512				0x00000200ULL
>  
> -#define SZ_1K				0x00000400
> -#define SZ_2K				0x00000800
> -#define SZ_4K				0x00001000
> -#define SZ_8K				0x00002000
> -#define SZ_16K				0x00004000
> -#define SZ_32K				0x00008000
> -#define SZ_64K				0x00010000
> -#define SZ_128K				0x00020000
> -#define SZ_256K				0x00040000
> -#define SZ_512K				0x00080000
> +#define SZ_1K				0x00000400ULL
> +#define SZ_2K				0x00000800ULL
> +#define SZ_4K				0x00001000ULL
> +#define SZ_8K				0x00002000ULL
> +#define SZ_16K				0x00004000ULL
> +#define SZ_32K				0x00008000ULL
> +#define SZ_64K				0x00010000ULL
> +#define SZ_128K				0x00020000ULL
> +#define SZ_256K				0x00040000ULL
> +#define SZ_512K				0x00080000ULL
>  
> -#define SZ_1M				0x00100000
> -#define SZ_2M				0x00200000
> -#define SZ_4M				0x00400000
> -#define SZ_8M				0x00800000
> -#define SZ_16M				0x01000000
> -#define SZ_32M				0x02000000
> -#define SZ_64M				0x04000000
> -#define SZ_128M				0x08000000
> -#define SZ_256M				0x10000000
> -#define SZ_512M				0x20000000
> +#define SZ_1M				0x00100000ULL
> +#define SZ_2M				0x00200000ULL
> +#define SZ_4M				0x00400000ULL
> +#define SZ_8M				0x00800000ULL
> +#define SZ_16M				0x01000000ULL
> +#define SZ_32M				0x02000000ULL
> +#define SZ_64M				0x04000000ULL
> +#define SZ_128M				0x08000000ULL
> +#define SZ_256M				0x10000000ULL
> +#define SZ_512M				0x20000000ULL
>  
> -#define SZ_1G				0x40000000
> -#define SZ_2G				0x80000000
> +#define SZ_1G				0x40000000ULL
> +#define SZ_2G				0x80000000ULL
>  
>  #endif /* __LINUX_SIZES_H__ */

_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux