From 55cd89aea870f3a3c5d586b4d2d499b38446d058 Mon Sep 17 00:00:00 2001 From: Taj Morton Date: Sun, 7 Jan 2024 13:04:19 -0800 Subject: [PATCH] Kernel/FileSystem/FATFS: Use AssertSize to enforce FAT structure sizes --- Kernel/FileSystem/FATFS/Definitions.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Kernel/FileSystem/FATFS/Definitions.h b/Kernel/FileSystem/FATFS/Definitions.h index a4d9675fcf..d094f85312 100644 --- a/Kernel/FileSystem/FATFS/Definitions.h +++ b/Kernel/FileSystem/FATFS/Definitions.h @@ -45,7 +45,7 @@ struct [[gnu::packed]] DOS3BIOSParameterBlock { u32 sector_count_32bit; // 0x020 -- end of DOS 3.31 BPB. }; // 11 is the boot jump/OEM identifier prefix prior to the official BPB. -static_assert(sizeof(DOS3BIOSParameterBlock) == 11 + 25); +static_assert(AssertSize()); struct [[gnu::packed]] DOS4BIOSParameterBlock { // Begins at sector offset 0x024. @@ -56,7 +56,7 @@ struct [[gnu::packed]] DOS4BIOSParameterBlock { char volume_label_string[11]; char file_system_type[8]; }; -static_assert(sizeof(DOS4BIOSParameterBlock) == 26); +static_assert(AssertSize()); struct [[gnu::packed]] DOS7BIOSParameterBlock { // Begins at sector offset 0x024. @@ -74,7 +74,7 @@ struct [[gnu::packed]] DOS7BIOSParameterBlock { char volume_label_string[11]; char file_system_type[8]; }; -static_assert(sizeof(DOS7BIOSParameterBlock) == 54); +static_assert(AssertSize()); enum DOSBIOSParameterBlockVersion { DOS_BPB_UNKNOWN, @@ -116,7 +116,7 @@ struct [[gnu::packed]] FATEntry { u16 first_cluster_low; u32 file_size; }; -static_assert(sizeof(FATEntry) == 32); +static_assert(AssertSize()); struct [[gnu::packed]] FATLongFileNameEntry { u8 entry_index; @@ -128,6 +128,6 @@ struct [[gnu::packed]] FATLongFileNameEntry { u16 zero; u16 characters3[2]; }; -static_assert(sizeof(FATLongFileNameEntry) == 32); +static_assert(AssertSize()); }