[AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, November 30, 2022 11:24 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Fix GCC build > error > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Fix below GCC build error: > 1) "Head" dereference issue. > 2) "BooleanArrayBuffer" uninitialized variable issue. > 3) Multiple definition of mRedfishVariableGuid. > 4) Multiple definition of medfishResourceConfigProtocolHandle. > > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > RedfishClientPkg/Include/RedfishBase.h | 3 ++- > .../EdkIIRedfishResourceConfigLib.c | 9 +++++---- > .../RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c | 5 +++-- > RedfishClientPkg/RedfishClientPkg.dec | 4 ++++ > .../RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c | 9 +++++---- > .../RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf | 2 ++ > RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c | 9 +++++---- > RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf | 2 ++ > 8 files changed, 28 insertions(+), 15 deletions(-) > > diff --git a/RedfishClientPkg/Include/RedfishBase.h > b/RedfishClientPkg/Include/RedfishBase.h > index cf320bb0eb..ea716d7054 100644 > --- a/RedfishClientPkg/Include/RedfishBase.h > +++ b/RedfishClientPkg/Include/RedfishBase.h > @@ -2,6 +2,7 @@ > Redfish base header file. > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -16,6 +17,6 @@ > /// > /// This GUID is used for an EFI Variable that stores the Redfish data. > /// > -EFI_GUID mRedfishVariableGuid = {0x91c46a3d, 0xed1a, 0x477b, {0xa5, 0x33, > 0x87, 0x2d, 0xcd, 0xb0, 0xfc, 0xc1}}; > +extern EFI_GUID gEfiRedfishClientVariableGuid; > > #endif > diff --git > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourc > eConfigLib.c > b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourc > eConfigLib.c > index 0d733bc6d2..c1598ffda6 100644 > --- > a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourc > eConfigLib.c > +++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfis > +++ hResourceConfigLib.c > @@ -2,6 +2,7 @@ > Redfish resource config library implementation > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -17,7 +18,7 @@ > #include > > EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL > *mRedfishResourceConfigProtocol = NULL; > -EFI_HANDLE medfishResourceConfigProtocolHandle; > +EFI_HANDLE mCachedHandle; > EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL > mRedfishFeatureInterchangeData; > REDFISH_SCHEMA_INFO mSchemaInfoCache; > > @@ -254,7 +255,7 @@ GetRedfishResourceConfigProtocol ( > AsciiStrCmp (Schema->Minor, mSchemaInfoCache.Minor) == 0 && > AsciiStrCmp (Schema->Errata, mSchemaInfoCache.Errata) == 0) { > if (Handle != NULL) { > - *Handle = medfishResourceConfigProtocolHandle; > + *Handle = mCachedHandle; > } > return mRedfishResourceConfigProtocol; > } > @@ -298,7 +299,7 @@ GetRedfishResourceConfigProtocol ( > } > > if (Found) { > - medfishResourceConfigProtocolHandle = HandleBuffer[Index]; > + mCachedHandle = HandleBuffer[Index]; > mRedfishResourceConfigProtocol = Protocol; > CopyMem (&mSchemaInfoCache, Schema, sizeof (REDFISH_SCHEMA_INFO)); > if (Handle != NULL) { > @@ -372,7 +373,7 @@ EdkIIRedfishResourceSetConfigureLang ( > EDKII_REDFISH_FEATURE_INTERCHANGE_DATA_PROTOCOL *Interface; > > Status = gBS->HandleProtocol ( > - medfishResourceConfigProtocolHandle, > + mCachedHandle, > &gEdkIIRedfishFeatureInterchangeDataProtocolGuid, > (VOID **)&Interface > ); > diff --git > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c > index 61383e2310..bfd6fff2a7 100644 > --- > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.c > +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUt > +++ ilityLib.c > @@ -2,6 +2,7 @@ > Redfish feature utility library implementation > > (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -1932,7 +1933,7 @@ RedfishGetUri ( > // > // String which has no ConfigLang remaining > // > - if (Head != '\0') { > + if (Head[0] != '\0') { > StrCatS (ResultStr, MAX_REDFISH_URL_LEN, Head); > } > > @@ -3173,7 +3174,7 @@ AddRedfishBooleanArray ( > RedfishCS_bool_Array *BooleanArrayBuffer; > RedfishCS_bool_Array *PreArrayBuffer; > > - if (Head == NULL || BooleanArrayBuffer == NULL || ArraySize == 0) { > + if (Head == NULL || BooleanArray == NULL || ArraySize == 0) { > return EFI_INVALID_PARAMETER; > } > > diff --git a/RedfishClientPkg/RedfishClientPkg.dec > b/RedfishClientPkg/RedfishClientPkg.dec > index 67929341df..d3c97ecf68 100644 > --- a/RedfishClientPkg/RedfishClientPkg.dec > +++ b/RedfishClientPkg/RedfishClientPkg.dec > @@ -2,6 +2,7 @@ > # Redfish Client Package > # > # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -51,6 +52,9 @@ > gEfiRedfishClientFeatureReadyToProvisioningGuid = { 0x77E4FC1C, 0x2428, > 0x47EE, { 0x9E, 0xEC, 0x8B, 0x77, 0xEF, 0x9D, 0x4E, 0xF0 } } > gEfiRedfishClientFeatureAfterProvisioningGuid = { 0xE547CB6F, 0x306F, > 0x4226, { 0xAB, 0x70, 0xA0, 0x6E, 0x26, 0xF1, 0x2E, 0xD0 } } > > + ## Include/RedfishBase.h > + gEfiRedfishClientVariableGuid = { 0x91c46a3d, 0xed1a, 0x477b, > { 0xa5, 0x33, 0x87, 0x2d, 0xcd, 0xb0, 0xfc, 0xc1 } } > + > [PcdsFixedAtBuild] > > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize|32|UINT > 32|0x10000001 > > gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UIN > T32|0x10000002 > diff --git > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > index 2762bbefab..dbfb3aaf82 100644 > --- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > +++ > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c > @@ -1,6 +1,7 @@ > /** @file > > (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -411,17 +412,17 @@ SaveConfigLangMapList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&Data, > NULL > ); > if (!EFI_ERROR (Status)) { > FreePool (Data); > - gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > + gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, > + VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > } > > > - return gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData); > + return gRT->SetVariable (VariableName, > + &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, > + (VOID *)VarData); > } > > /** > @@ -457,7 +458,7 @@ InitialConfigLangMapList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&VarData, > &VariableSize > ); > diff --git > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf > b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf > index 9f19533815..821f05523c 100644 > --- > a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf > +++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.i > +++ nf > @@ -1,6 +1,7 @@ > ## @file > # > # (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -41,6 +42,7 @@ > > [Guids] > gEfiEventExitBootServicesGuid ## CONSUMED ## > + gEfiRedfishClientVariableGuid ## CONSUMED ## > > [Depex] > TRUE > diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > index 52015672f9..815071dfe9 100644 > --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c > @@ -1,6 +1,7 @@ > /** @file > > (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -398,17 +399,17 @@ SaveETagList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&Data, > NULL > ); > if (!EFI_ERROR (Status)) { > FreePool (Data); > - gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > + gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, > + VARIABLE_ATTRIBUTE_NV_BS, 0, NULL); > } > > > - return gRT->SetVariable (VariableName, &mRedfishVariableGuid, > VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData); > + return gRT->SetVariable (VariableName, > + &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, > + (VOID *)VarData); > } > > /** > @@ -444,7 +445,7 @@ InitialETagList ( > // > Status = GetVariable2 ( > VariableName, > - &mRedfishVariableGuid, > + &gEfiRedfishClientVariableGuid, > (VOID *)&VarData, > &VariableSize > ); > diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > index e29a10456e..4aecdb4191 100644 > --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf > @@ -1,6 +1,7 @@ > ## @file > # > # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> +# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -40,6 +41,7 @@ > > [Guids] > gEfiEventExitBootServicesGuid ## CONSUMES ## Event > + gEfiRedfishClientVariableGuid ## CONSUMED ## > > [Depex] > TRUE > -- > 2.38.1.windows.1