From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.115]) by mx.groups.io with SMTP id smtpd.web11.60783.1683437977830434699 for ; Sat, 06 May 2023 22:39:38 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="no key for verify" header.i=@amperemail.onmicrosoft.com header.s=selector1-amperemail-onmicrosoft-com header.b=n0RGBl9t; spf=pass (domain: os.amperecomputing.com, ip: 40.107.223.115, mailfrom: minhnguyen1@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EwRVwMTrJkeGBVhBAE/frsxA7dkKwKWXslUnRKEpvWsj52XxWNXoEbT5+G515BDVpMFmCkhMD4rSY4869HAxnIAKXGtmLO5vtmQSHFFj3pid+uKva49h7q3lk5Gk6qYQc1I2nGe/OBhJGYtCqvGK2kREo4vooDH7h1gidnwWH9XJhhiCnZQgplDgQv49+IuMzWzJ5AKl+ZGVb+Wmi9uJZFI6HBIHzV/AX1SZ3SriF3Z8yWJ0G8S7xlDheN4sSL9ILYsiKmOlxQPmiBn0L+ndwXceXnaaQlgZxwbilG8O080evL8Tkyu54nsildsG8wxJftpssGUNV02APgDWoHr0Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+BOvslyrEQDA+Xke2fywBXFR16x0UgeBOSRbF/GEvfM=; b=OB6pV4LLdpsz8jgQyA7W3O32CrMJg6YQk+oAVrEAxxFrvFIQgtz8haGV0SAd4I6TF0tm1HMm9DWoviP3FqPkHXmkcLCcsyRMT+lLhWgunMN+o3/1lVx0EHB1OUnnzyQuEv2/rkVuS07PB/sxG7s6rzchfYV5DhteWib49Da+W3pNZeLvHimtjpxc0PMzOUZ4Zr4U9IuLjFaJOtz7E0sxDncuaO9UpAcBnYL2Vb2M+SvNO7xwMDRvaiRoORYWLSjZvPMrU7MK0iwi3cCdLmrvrNg/0RUs9I+HCKcQhxA83StzvP126aMPwXPtYE7K+IxRP1GZIYj0Q1stoTZ2cK6xkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=amperemail.onmicrosoft.com; dkim=pass header.d=amperemail.onmicrosoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amperemail.onmicrosoft.com; s=selector1-amperemail-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+BOvslyrEQDA+Xke2fywBXFR16x0UgeBOSRbF/GEvfM=; b=n0RGBl9tgjG8KAtG6zrfUFq695qYSTBfcDWuWjpQGi9igfnBu3HpAlBN28ctn5C65nZeoeTX/D+U3IphX3/MA2mqPO/HxzortyFhrsvvhPQHzD9gA70gfs59bmq20B9PQEFEyDQ5BS33iT6IBKUKayaqrX0WUiawnAzdwd5DQuk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amperemail.onmicrosoft.com; Received: from PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) by MN2PR01MB5536.prod.exchangelabs.com (2603:10b6:208:118::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.30; Sun, 7 May 2023 05:39:33 +0000 Received: from PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1]) by PH0PR01MB8048.prod.exchangelabs.com ([fe80::bbdb:b58c:140e:c4e1%7]) with mapi id 15.20.6363.029; Sun, 7 May 2023 05:39:33 +0000 Message-ID: Date: Sun, 7 May 2023 12:39:23 +0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [edk2-devel] [PATCH V3 5/5] RedfishPkg: Fix compile issue on Linux To: Pedro Falcato , devel@edk2.groups.io, minhnguyen1@os.amperecomputing.com Cc: patches@amperecomputing.com, abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com, nhi@os.amperecomputing.com, tinhnguyen@os.amperecomputing.com, Vu Nguyen , Nick Ramirez References: <20230505035824.1466954-1-minhnguyen1@os.amperecomputing.com> <20230505035824.1466954-6-minhnguyen1@os.amperecomputing.com> From: Minh Nguyen In-Reply-To: X-ClientProxiedBy: SG2PR01CA0127.apcprd01.prod.exchangelabs.com (2603:1096:4:40::31) To PH0PR01MB8048.prod.exchangelabs.com (2603:10b6:510:280::7) Return-Path: minhnguyen1@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB8048:EE_|MN2PR01MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 36d11a32-4def-4791-ec0b-08db4ebd6f66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1Lvkk9vaafHpysHASGM6hw307JgtbE3huzfiUVL85alCrSeBVbqywxa3BBHBS5XR5w0iFeIs0RcbapD65ZBRNOq7rmSV3FODKmrx+6VOSYi0IsNd+rtP5ul584H3yDgWNPrRsRRyxYsp/I0nSXeUi8Ld7u6xnmozhdB7VOaZhbLNAhbUt4sAe3EC2kN2O8cotXLMOAjcOW8Le8hOUkuGKSGVjkPMhiH8aoc0dzH/h7yMiQjrJtuFQ+JClGMCQt+nBQogbllqGB/KIwGw4ObmAoqVaFbqqn2HxwUlGxJI4FJA+ne2mcRkfx0DaMqLJe1OC3mEg981paS0CL+VPa7VI6JVKwWD1LYbF0khdsMs+1Ru28C7paERn2UG5JKfEX8E2e2spkVs7hGfhd+UT2fZIGjFBkXgbhdSuPWigQZ64kQfw9re0d41EEf6Sn85Pr6e3JZF98BjTAZ3Dce11cSDhdWTd6KG7JIAGCQQ8OCDsMKxLL6PLS/bniSAw/L/vPJ++lhEyeaaig0IwEnFX/OpguDfktaVQ3A1eYQqybsiQwlUG+LoCP6RqOzuFhT7MI5gEsNfeKGI4n13/eAsXk6HpGSEAccCqz8hPz3Y1X7ifB8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB8048.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39840400004)(366004)(136003)(396003)(376002)(346002)(451199021)(31686004)(33964004)(66946007)(66556008)(66476007)(4326008)(478600001)(6486002)(316002)(19627235002)(54906003)(31696002)(42882007)(83380400001)(2616005)(53546011)(6506007)(26005)(6512007)(6666004)(8936002)(5660300002)(8676002)(41300700001)(2906002)(166002)(38100700002)(186003)(83170400001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RmRFcXUxVXNWMHZPQ3UrNU9WZUxwYzRaYlVrdktRVzZBWnA3K3prajZ1NkdW?= =?utf-8?B?NmNmdE85VFNMSThVRGRIQWFSUkVHTHQ2SE1melU2emx5bGZwc01xS0htcmVv?= =?utf-8?B?REExZms5RmYxLzFOTGxlWjJYWEVFb0ovWitoRFllTXhIU3dtTEVzMSsxNElW?= =?utf-8?B?SVllRkU2SWltYnBRV1kvN0l1UXRJdkNrVWVzSGsxYk0wMmFxbVFJQjM2RjhD?= =?utf-8?B?dS90dEhzZWVvTzR5eHhhMEtkalRqNEFxRzlDUGYrQUxyeThqUkVsQ0g2ekxp?= =?utf-8?B?UTZUd2ZsdUVPOUE2RVBRN0l6UWtoY2s5S3JIVTRmdlpLdXNaZ29VaFFvdnpW?= =?utf-8?B?YWdwOExBdDBZbDB2SWNJdk5GbDgyd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?1u5/2e/b/ePMtEbnHw7EGjM=3D?= X-OriginatorOrg: amperemail.onmicrosoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36d11a32-4def-4791-ec0b-08db4ebd6f66 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB8048.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2023 05:39:33.1362 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bYNsiuiJ4fPwjPzx9GGZbtK0WD4LWMJZm1zOD+XpL+xhn52E2ul6spcqW4lf2i8NK+Gjpigsa+SYMOmgmWpH1DcbLjZgWdGn6VsdtpQ1HJTRDW4VaSTjz8DPaJlg2Sf5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR01MB5536 Content-Type: multipart/alternative; boundary="------------Y777NqQHY1Y9yDVJap0VeSGQ" Content-Language: en-CA --------------Y777NqQHY1Y9yDVJap0VeSGQ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi Pedro, Firstly, thanks for your comments, let me explain. - "C99 flexible array members have been well defined and well supported for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)" => *Yes, I agree and there's no** **comment from my side* *but this is completely different with current issue, why? Please see the bellow** **explanation.* - When we define the PCD to map with any structure in .dec file, BaseTools will gen /*PcdValueInit.c*/. In this file, there're a lot of using "/*__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath);*/" and this is the definiton of this macro "/*#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)*/". When using "/*__STATIC_ASSERT((__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) >= 3) || *//* *//*(__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) == 0), "Input buffer exceeds the buffer array");*/", "/*(sizeof((TYPE *)0)->Field*/" will be an error (_*error: invalid application of ‘sizeof’ to incomplete type *__* *__*EFI_DEVICE_PATH_PROTOCOL[]*_) => will cause error on "__STATIC_ASSERT" because _Static_assert requires its first parameter to be a constant expression => the error message when compile this code is "_*Line 257 Value {0x03,0x0b,0x25,0x00,0x00,0x1b,*__* *__*0x21,0xdc,0x35,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,*__* *__*0x00,0x00,0x00,0x00,0x00,0x01,0x7f,0xff,0x04,0x00}:293:19: error: expression in static assertion is not an integer*_" - An other demonstation on other platforms in this behavior: you can check at *edk2-platforms/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec*. /*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD0000001 {*//* *//*    *//* *//*      IndustryStandard/SmBios.h*//* *//*    *//* *//*      MdePkg/MdePkg.dec*//* *//*SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec*//* *//*  }*/ /*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33*//* *//*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F*/ This is the declaration to map PcdSmbiosType0BiosInformation with SMBIOS_TABLE_TYPE0 structure and the declaration of BIOSCharacteristicsExtensionBytes is "*UINT8 BIOSCharacteristicsExtensionBytes[2];*". If we remove the number of elements (2) to flexible array, we will see the same error like "_*Index of BIOSCharacteristicsExtensionBytes[0]:361:19: *__* *__*error: expression in static assertion is not an integer*_". => Conclusion: This is not problem on compiler, it just comes from the way BasTools gen PcdValueInit.c and define macros for this case (map PCD structure to any structure). I hope it satisfy your concerns. Thanks, Minh Nguyen. On 5/6/2023 5:57 AM, Pedro Falcato wrote: > On Fri, May 5, 2023 at 6:12 PM Minh Nguyen via groups.io > wrote: >> From: Vu Nguyen >> >> It requires a fixed size array to store the content of device path PCD. >> Add the array size to solve this issue. >> >> Signed-off-by: Minh Nguyen >> Cc: Abner Chang >> Cc: Igor Kulchytskyy >> Cc: Nick Ramirez >> Reviewed-by: Abner Chang >> --- >> RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h >> index 91b1198297c2..57fc199f61f2 100644 >> --- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h >> +++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h >> @@ -4,6 +4,7 @@ >> >> Copyright (c) 2019, Intel Corporation. All rights reserved.
>> (C) Copyright 2020 Hewlett Packard Enterprise Development LP
>> + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
>> >> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> @@ -14,6 +15,8 @@ >> >> #include >> >> +#define MAX_DEVICE_PATH_NODE 40 >> + >> typedef enum { >> DEVICE_PATH_MATCH_MAC_NODE = 1, >> DEVICE_PATH_MATCH_PCI_NODE = 2, >> @@ -32,7 +35,7 @@ typedef struct { >> // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, >> // 0x7f,0xff,0x04,0x00} >> // >> - EFI_DEVICE_PATH_PROTOCOL DevicePath[]; >> + EFI_DEVICE_PATH_PROTOCOL DevicePath[MAX_DEVICE_PATH_NODE]; >> } REST_EX_SERVICE_DEVICE_PATH_DATA; > This doesn't work (changes the meaning) and may possibly break ABI. > > What error do you get? What compiler? > > C99 flexible array members have been well defined and well supported > for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6) > --------------Y777NqQHY1Y9yDVJap0VeSGQ Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi Pedro,

Firstly, thanks for your comments, let me explain.

- "C99 flexible array members have been well defined and well supported
for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)" => Yes, I agree and there's no
comment from my side but this is completely different with current issue, why? Please see the bellow
explanation.
- When we define the PCD to map with any structure in .dec file, BaseTools will gen PcdValueInit.c.
In this file, there're a lot of using "__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath);"
and this is the definiton of this macro "#define __FIELD_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field)".
When using "__STATIC_ASSERT((__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) >= 3) ||
(__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) == 0), "Input buffer exceeds the buffer array");",
"(sizeof((TYPE *)0)->Field" will be an error (error: invalid application of ‘sizeof’ to incomplete type
EFI_DEVICE_PATH_PROTOCOL[]) => will cause error on "__STATIC_ASSERT" because _Static_assert requires its first parameter
to be a constant expression => the error message when compile this code is "Line 257 Value {0x03,0x0b,0x25,0x00,0x00,0x1b,
0x21,0xdc,0x35,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x01,0x7f,0xff,0x04,0x00}:293:19: error: expression in static assertion is not an integer"

- An other demonstation on other platforms in this behavior: you can check at edk2-platforms/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec.
  gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD0000001 {
    <HeaderFiles>
      IndustryStandard/SmBios.h
    <Packages>
      MdePkg/MdePkg.dec
      SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec
  }
  gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33
  gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F
This is the declaration to map PcdSmbiosType0BiosInformation with SMBIOS_TABLE_TYPE0 structure and
the declaration of BIOSCharacteristicsExtensionBytes is "UINT8 BIOSCharacteristicsExtensionBytes[2];". If
we remove the number of elements (2) to flexible array, we will see the same error like "Index of BIOSCharacteristicsExtensionBytes[0]:361:19:
error: expression in static assertion is not an integer".

=> Conclusion: This is not problem on compiler, it just comes from the way BasTools gen PcdValueInit.c
and define macros for this case (map PCD structure to any structure). I hope it satisfy your concerns.


Thanks,

Minh Nguyen.

On 5/6/2023 5:57 AM, Pedro Falcato wrote:
On Fri, May 5, 2023 at 6:12 PM Minh Nguyen via groups.io
<minhnguyen1=os.amperecomputing.com@groups.io> wrote:
From: Vu Nguyen <vunguyen@os.amperecomputing.com>

It requires a fixed size array to store the content of device path PCD.
Add the array size to solve this issue.

Signed-off-by: Minh Nguyen <minhnguyen1@os.amperecomputing.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <Abner.Chang@amd.com>
---
 RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
index 91b1198297c2..57fc199f61f2 100644
--- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
+++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
@@ -4,6 +4,7 @@

   Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
   (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>

     SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -14,6 +15,8 @@

 #include <Protocol/DevicePath.h>

+#define MAX_DEVICE_PATH_NODE      40
+
 typedef enum {
   DEVICE_PATH_MATCH_MAC_NODE = 1,
   DEVICE_PATH_MATCH_PCI_NODE = 2,
@@ -32,7 +35,7 @@ typedef struct {
   //    0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
   //    0x7f,0xff,0x04,0x00}
   //
-  EFI_DEVICE_PATH_PROTOCOL    DevicePath[];
+  EFI_DEVICE_PATH_PROTOCOL      DevicePath[MAX_DEVICE_PATH_NODE];
 } REST_EX_SERVICE_DEVICE_PATH_DATA;
This doesn't work (changes the meaning) and may possibly break ABI.

What error do you get? What compiler?

C99 flexible array members have been well defined and well supported
for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)

--------------Y777NqQHY1Y9yDVJap0VeSGQ--