* [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes
@ 2023-10-31 19:35 Vladimir 'phcoder' Serbinenko
2023-10-31 21:44 ` John Paul Adrian Glaubitz
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-10-31 19:35 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
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>
--
Regards
Vladimir 'phcoder' Serbinenko
[-- Attachment #2: 0004-gpt-Add-compile-time-asserts-for-guid-and-gpt_parten.patch --]
[-- Type: text/x-patch, Size: 1041 bytes --]
From 6a4e58a9fe989dbe0f6b3ef9865cab05a55ac19a Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 13 Aug 2023 09:18:53 +0200
Subject: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry
sizes
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
[-- Attachment #3: Type: text/plain, Size: 141 bytes --]
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes
2023-10-31 19:35 [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes Vladimir 'phcoder' Serbinenko
@ 2023-10-31 21:44 ` John Paul Adrian Glaubitz
0 siblings, 0 replies; 4+ messages in thread
From: John Paul Adrian Glaubitz @ 2023-10-31 21:44 UTC (permalink / raw)
To: Vladimir 'phcoder' Serbinenko; +Cc: The development of GNU GRUB
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
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes
2023-10-07 15:08 Vladimir 'phcoder' Serbinenko
@ 2023-10-17 16:43 ` Daniel Kiper
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Kiper @ 2023-10-17 16:43 UTC (permalink / raw)
To: Vladimir 'phcoder' Serbinenko; +Cc: The development of GRUB 2
On Sat, Oct 07, 2023 at 05:08:48PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> From c338c54a127656ef0f750d78bad6371874a98ca8 Mon Sep 17 00:00:00 2001
> From: Vladimir Serbinenko <phcoder@gmail.com>
> Date: Sun, 13 Aug 2023 09:18:53 +0200
> Subject: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry
> sizes
>
Could you add a commit message which explains why this patch is needed?
> 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);
> }
Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes
@ 2023-10-07 15:08 Vladimir 'phcoder' Serbinenko
2023-10-17 16:43 ` Daniel Kiper
0 siblings, 1 reply; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2023-10-07 15:08 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1.1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #1.2: Type: text/html, Size: 23 bytes --]
[-- Attachment #2: 0004-gpt-Add-compile-time-asserts-for-guid-and-gpt_parten.patch --]
[-- Type: text/x-patch, Size: 882 bytes --]
From c338c54a127656ef0f750d78bad6371874a98ca8 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 13 Aug 2023 09:18:53 +0200
Subject: [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry
sizes
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
[-- Attachment #3: Type: text/plain, Size: 141 bytes --]
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-31 21:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-31 19:35 [PATCH 4/4] gpt: Add compile time asserts for guid and gpt_partentry sizes Vladimir 'phcoder' Serbinenko
2023-10-31 21:44 ` John Paul Adrian Glaubitz
-- strict thread matches above, loose matches on Subject: below --
2023-10-07 15:08 Vladimir 'phcoder' Serbinenko
2023-10-17 16:43 ` Daniel Kiper
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.