From: Andre Przywara <andre.przywara@arm.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: will@kernel.org, julien.thierry.kdev@gmail.com, maz@kernel.org,
suzuki.poulose@arm.com, julien@xen.org,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, james.morse@arm.com
Subject: Re: [PATCH v3 kvmtool 02/13] sizes.h: Make all sizes 64bit
Date: Mon, 30 May 2022 16:05:17 +0100 [thread overview]
Message-ID: <20220530160517.657115f8@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20220525112345.121321-3-alexandru.elisei@arm.com>
On Wed, 25 May 2022 12:23:34 +0100
Alexandru Elisei <alexandru.elisei@arm.com> 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@arm.com>
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> ---
> 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__ */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-01 13:41 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 11:23 [PATCH v3 kvmtool 00/13] arm64: Allow the user to set RAM base address Alexandru Elisei
2022-05-25 11:23 ` [PATCH v3 kvmtool 01/13] Use MB for megabytes consistently Alexandru Elisei
2022-05-25 11:23 ` [PATCH v3 kvmtool 02/13] sizes.h: Make all sizes 64bit Alexandru Elisei
2022-05-30 15:05 ` Andre Przywara [this message]
2022-06-15 16:01 ` Alexandru Elisei
2022-05-25 11:23 ` [PATCH v3 kvmtool 03/13] builtin-run: Always use RAM size in bytes Alexandru Elisei
2022-05-25 11:23 ` [PATCH v3 kvmtool 04/13] builtin-run: Rework RAM size validation Alexandru Elisei
2022-05-30 17:13 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 05/13] builtin-run: Add arch hook to validate VM configuration Alexandru Elisei
2022-05-25 11:23 ` [PATCH v3 kvmtool 06/13] arm/arm64: Fail if RAM size is too large for 32-bit guests Alexandru Elisei
2022-06-01 11:09 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 07/13] arm/arm64: Kill the ARM_MAX_MEMORY() macro Alexandru Elisei
2022-06-01 11:14 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 08/13] arm/arm64: Kill the ARM_HIMAP_MAX_MEMORY() macro Alexandru Elisei
2022-06-01 11:16 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 09/13] builtin_run: Allow standard size specifiers for memory Alexandru Elisei
2022-06-01 13:39 ` Andre Przywara
2022-06-01 14:17 ` Alexandru Elisei
2022-06-01 16:14 ` Andre Przywara
2022-06-01 19:39 ` Alexandru Elisei
2022-06-01 19:42 ` Alexandru Elisei
2022-06-01 20:13 ` Alexandru Elisei
2022-06-06 10:53 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 10/13] kvm__arch_init: Remove hugetlbfs_path and ram_size as parameters Alexandru Elisei
2022-06-01 13:13 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 11/13] arm/arm64: Consolidate RAM initialization in kvm__init_ram() Alexandru Elisei
2022-06-01 13:20 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 12/13] Introduce kvm__arch_default_ram_address() Alexandru Elisei
2022-06-01 13:21 ` Andre Przywara
2022-05-25 11:23 ` [PATCH v3 kvmtool 13/13] arm64: Allow the user to specify the RAM base address Alexandru Elisei
2022-06-01 13:39 ` Andre Przywara
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=20220530160517.657115f8@donnerap.cambridge.arm.com \
--to=andre.przywara@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=julien@xen.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox