From ce655f5bd5053172b8369c666610676a09b17267 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Sun, 30 Jul 2023 12:53:47 +0200 Subject: [PATCH] vendorcode/intel/edk2: Use C99 flexible arrays Use C99 flexible arrays instead of older style of one-element or zero-length arrays. It allows the compiler to generate errors when the flexible array does not occur at the end in the structure. Change-Id: If093dc08c70c521cbef96ac5b5a7a46b37169bcd Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/76810 Tested-by: build bot (Jenkins) Reviewed-by: Jan Samek Reviewed-by: Felix Singer --- .../MdePkg/Include/IndustryStandard/TcgStorageCore.h | 6 +++--- .../edk2/UDK2017/MdePkg/Include/Protocol/NvdimmLabel.h | 2 +- .../MdePkg/Include/IndustryStandard/IpmiNetFnApp.h | 4 ++-- .../MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h | 2 +- .../MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h | 4 ++-- .../MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h | 8 ++++---- .../MdePkg/Include/IndustryStandard/TcgStorageCore.h | 6 +++--- .../MdePkg/Include/Protocol/NvdimmLabel.h | 2 +- .../MdePkg/Include/IndustryStandard/IpmiNetFnApp.h | 8 ++++---- .../MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h | 4 ++-- .../MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h | 6 +++--- .../MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h | 8 ++++---- .../MdePkg/Include/IndustryStandard/TcgStorageCore.h | 6 +++--- 13 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/IndustryStandard/TcgStorageCore.h b/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/IndustryStandard/TcgStorageCore.h index 79954df5ad..adacc57f65 100644 --- a/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/IndustryStandard/TcgStorageCore.h +++ b/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/IndustryStandard/TcgStorageCore.h @@ -39,7 +39,7 @@ typedef struct { UINT32 OutstandingDataBE; UINT32 MinTransferBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_COM_PACKET; typedef struct { @@ -50,7 +50,7 @@ typedef struct { UINT16 AckTypeBE; UINT32 AcknowledgementBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_PACKET; #define TCG_SUBPACKET_ALIGNMENT 4 // 4-byte alignment per spec @@ -59,7 +59,7 @@ typedef struct { UINT8 ReservedBE[6]; UINT16 KindBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_SUB_PACKET; #define SUBPACKET_KIND_DATA 0x0000 diff --git a/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Protocol/NvdimmLabel.h b/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Protocol/NvdimmLabel.h index edfeec0eb0..638ba2bf29 100644 --- a/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Protocol/NvdimmLabel.h +++ b/src/vendorcode/intel/edk2/UDK2017/MdePkg/Include/Protocol/NvdimmLabel.h @@ -250,7 +250,7 @@ typedef struct { /// /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces. /// - EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0]; + EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[]; } EFI_NVDIMM_LABEL_SET_COOKIE_INFO; /** diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h index 499175f1c4..e9b51e8bdb 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h @@ -432,7 +432,7 @@ typedef union { typedef struct { UINT8 CompletionCode; IPMI_GET_MESSAGE_CHANNEL_NUMBER ChannelNumber; - UINT8 MessageData[0]; + UINT8 MessageData[]; } IPMI_GET_MESSAGE_RESPONSE; // @@ -456,7 +456,7 @@ typedef union { typedef struct { UINT8 CompletionCode; IPMI_SEND_MESSAGE_CHANNEL_NUMBER ChannelNumber; - UINT8 MessageData[0]; + UINT8 MessageData[]; } IPMI_SEND_MESSAGE_REQUEST; typedef struct { diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h index c20091fedc..0209d447ff 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h @@ -183,7 +183,7 @@ typedef union { typedef struct { IPMI_SET_BOOT_OPTIONS_PARAMETER_VALID ParameterValid; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_BOOT_OPTIONS_REQUEST; // diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h index c69df8f303..e1b812b973 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h @@ -76,7 +76,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 CountReturned; - UINT8 Data[0]; + UINT8 Data[]; } IPMI_READ_FRU_DATA_RESPONSE; // @@ -95,7 +95,7 @@ typedef struct { typedef struct { UINT8 DeviceId; UINT16 InventoryOffset; - UINT8 Data[0]; + UINT8 Data[]; } IPMI_WRITE_FRU_DATA_REQUEST; typedef struct { diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h index 6ede54cbea..48b0a31c33 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h @@ -281,7 +281,7 @@ typedef union { typedef struct { IPMI_SET_LAN_CONFIG_CHANNEL_NUM ChannelNumber; UINT8 ParameterSelector; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_LAN_CONFIGURATION_PARAMETERS_COMMAND_REQUEST; // @@ -311,7 +311,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 ParameterRevision; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE; // @@ -848,7 +848,7 @@ typedef union { typedef struct { IPMI_SET_SOL_CONFIG_PARAM_CHANNEL_NUM ChannelNumber; UINT8 ParameterSelector; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST; // @@ -878,7 +878,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 ParameterRevision; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE; #pragma pack() diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/TcgStorageCore.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/TcgStorageCore.h index a9c1332d2d..4107be6ece 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/TcgStorageCore.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/IndustryStandard/TcgStorageCore.h @@ -38,7 +38,7 @@ typedef struct { UINT32 OutstandingDataBE; UINT32 MinTransferBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_COM_PACKET; typedef struct { @@ -49,7 +49,7 @@ typedef struct { UINT16 AckTypeBE; UINT32 AcknowledgementBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_PACKET; #define TCG_SUBPACKET_ALIGNMENT 4 // 4-byte alignment per spec @@ -58,7 +58,7 @@ typedef struct { UINT8 ReservedBE[6]; UINT16 KindBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_SUB_PACKET; #define SUBPACKET_KIND_DATA 0x0000 diff --git a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Protocol/NvdimmLabel.h b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Protocol/NvdimmLabel.h index c9b5642bc3..310f2afbdf 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Protocol/NvdimmLabel.h +++ b/src/vendorcode/intel/edk2/edk2-stable202005/MdePkg/Include/Protocol/NvdimmLabel.h @@ -244,7 +244,7 @@ typedef struct { /// /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces. /// - EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0]; + EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[]; } EFI_NVDIMM_LABEL_SET_COOKIE_INFO; /** diff --git a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h index eb9addbd08..37f8724e42 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h +++ b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h @@ -432,7 +432,7 @@ typedef union { typedef struct { UINT8 CompletionCode; IPMI_GET_MESSAGE_CHANNEL_NUMBER ChannelNumber; - UINT8 MessageData[0]; + UINT8 MessageData[]; } IPMI_GET_MESSAGE_RESPONSE; // @@ -456,12 +456,12 @@ typedef union { typedef struct { UINT8 CompletionCode; IPMI_SEND_MESSAGE_CHANNEL_NUMBER ChannelNumber; - UINT8 MessageData[0]; + UINT8 MessageData[]; } IPMI_SEND_MESSAGE_REQUEST; typedef struct { UINT8 CompletionCode; - UINT8 ResponseData[0]; + UINT8 ResponseData[]; } IPMI_SEND_MESSAGE_RESPONSE; // @@ -905,7 +905,7 @@ typedef union { typedef struct { IPMI_SET_USER_PASSWORD_USER_ID UserId; IPMI_SET_USER_PASSWORD_OPERATION Operation; - UINT8 PasswordData[0]; // 16 or 20 bytes, depending on the 'PasswordSize' field + UINT8 PasswordData[]; // 16 or 20 bytes, depending on the 'PasswordSize' field } IPMI_SET_USER_PASSWORD_REQUEST; // diff --git a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h index ead94a1626..ea00bd221f 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h +++ b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h @@ -183,7 +183,7 @@ typedef union { typedef struct { IPMI_SET_BOOT_OPTIONS_PARAMETER_VALID ParameterValid; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_BOOT_OPTIONS_REQUEST; typedef struct { @@ -415,7 +415,7 @@ typedef struct { UINT8 CompletionCode; IPMI_GET_BOOT_OPTIONS_PARAMETER_VERSION ParameterVersion; IPMI_GET_BOOT_OPTIONS_PARAMETER_VALID ParameterValid; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_GET_BOOT_OPTIONS_RESPONSE; // diff --git a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h index cb273133de..7e7f051bf6 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h +++ b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h @@ -76,7 +76,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 CountReturned; - UINT8 Data[0]; + UINT8 Data[]; } IPMI_READ_FRU_DATA_RESPONSE; // @@ -95,7 +95,7 @@ typedef struct { typedef struct { UINT8 DeviceId; UINT16 InventoryOffset; - UINT8 Data[0]; + UINT8 Data[]; } IPMI_WRITE_FRU_DATA_REQUEST; typedef struct { @@ -594,7 +594,7 @@ typedef struct { UINT16 RecordId; UINT8 OffsetIntoRecord; UINT8 InProgress; - UINT8 RecordData[0]; + UINT8 RecordData[]; } IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST; typedef struct { diff --git a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h index 58046432eb..0081afb8dd 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h +++ b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h @@ -313,7 +313,7 @@ typedef union { typedef struct { IPMI_SET_LAN_CONFIG_CHANNEL_NUM ChannelNumber; UINT8 ParameterSelector; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_LAN_CONFIGURATION_PARAMETERS_COMMAND_REQUEST; // @@ -343,7 +343,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 ParameterRevision; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE; // @@ -879,7 +879,7 @@ typedef union { typedef struct { IPMI_SET_SOL_CONFIG_PARAM_CHANNEL_NUM ChannelNumber; UINT8 ParameterSelector; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST; // @@ -909,7 +909,7 @@ typedef struct { typedef struct { UINT8 CompletionCode; UINT8 ParameterRevision; - UINT8 ParameterData[0]; + UINT8 ParameterData[]; } IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE; #pragma pack() diff --git a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/TcgStorageCore.h b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/TcgStorageCore.h index 9253049c47..7b76dc6948 100644 --- a/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/TcgStorageCore.h +++ b/src/vendorcode/intel/edk2/edk2-stable202302/MdePkg/Include/IndustryStandard/TcgStorageCore.h @@ -38,7 +38,7 @@ typedef struct { UINT32 OutstandingDataBE; UINT32 MinTransferBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_COM_PACKET; typedef struct { @@ -49,7 +49,7 @@ typedef struct { UINT16 AckTypeBE; UINT32 AcknowledgementBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_PACKET; #define TCG_SUBPACKET_ALIGNMENT 4// 4-byte alignment per spec @@ -58,7 +58,7 @@ typedef struct { UINT8 ReservedBE[6]; UINT16 KindBE; UINT32 LengthBE; - UINT8 Payload[0]; + UINT8 Payload[]; } TCG_SUB_PACKET; #define SUBPACKET_KIND_DATA 0x0000