[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry
From: |
John Paul Adrian Glaubitz |
Subject: |
Re: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes |
Date: |
Tue, 31 Oct 2023 22:44:22 +0100 |
User-agent: |
Evolution 3.50.1 |
On Tue, 2023-10-31 at 20:35 +0100, Vladimir 'phcoder' Serbinenko wrote:
> With new alignment specification it's easy to screw up. Fortunately if it
> happens the size will be bigger than intended. Compile time assert will catch
> this.
>
> Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
> ---
> grub-core/partmap/gpt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c
> index 877ceefc3..426f616ae 100644
> --- a/grub-core/partmap/gpt.c
> +++ b/grub-core/partmap/gpt.c
> @@ -229,6 +229,9 @@ static struct grub_partition_map grub_gpt_partition_map =
>
> GRUB_MOD_INIT(part_gpt)
> {
> + COMPILE_TIME_ASSERT(sizeof(grub_guid_t) == 16);
> + COMPILE_TIME_ASSERT(sizeof(grub_packed_guid_t) == 16);
> + COMPILE_TIME_ASSERT(sizeof(struct grub_gpt_partentry) == 128);
> grub_partition_map_register (&grub_gpt_partition_map);
> }
>
> --
> 2.39.2
>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913