public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Fix GCC build error
@ 2022-11-30 15:24 Nickle Wang
  2022-12-01  0:53 ` Chang, Abner
  0 siblings, 1 reply; 3+ messages in thread
From: Nickle Wang @ 2022-11-30 15:24 UTC (permalink / raw)
  To: devel; +Cc: Abner Chang, Igor Kulchytskyy, Nick Ramirez

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 <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 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<BR>
+  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/EdkIIRedfishResourceConfigLib.c b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
index 0d733bc6d2..c1598ffda6 100644
--- a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
+++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
@@ -2,6 +2,7 @@
   Redfish resource config library implementation
 
   (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -17,7 +18,7 @@
 #include <Library/RedfishPlatformConfigLib.h>
 
 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/RedfishFeatureUtilityLib.c
@@ -2,6 +2,7 @@
   Redfish feature utility library implementation
 
   (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+  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<BR>
+# 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|UINT32|0x10000001
   gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize|8|UINT32|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<BR>
+  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.inf
@@ -1,6 +1,7 @@
 ## @file
 #
 #  (C) Copyright 2022 Hewlett Packard Enterprise Development LP<BR>
+#  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<BR>
+  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<BR>
+#  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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-01  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-30 15:24 [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Fix GCC build error Nickle Wang
2022-12-01  0:53 ` Chang, Abner
2022-12-01  1:33   ` Igor Kulchytskyy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox