public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nickle Wang" <nicklew@nvidia.com>
To: <devel@edk2.groups.io>
Cc: Abner Chang <abner.chang@amd.com>,
	Igor Kulchytskyy <igork@ami.com>,
	"Nick Ramirez" <nramirez@nvidia.com>
Subject: [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Fix GCC build error
Date: Wed, 30 Nov 2022 23:24:18 +0800	[thread overview]
Message-ID: <20221130152418.361-1-nicklew@nvidia.com> (raw)

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


             reply	other threads:[~2022-11-30 15:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 15:24 Nickle Wang [this message]
2022-12-01  0:53 ` [edk2-staging][PATCH] edk2-staging/RedfishClientPkg: Fix GCC build error Chang, Abner
2022-12-01  1:33   ` Igor Kulchytskyy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221130152418.361-1-nicklew@nvidia.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox