public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 0/3] RedfishPkg: refine HiiUtilityLib and fix USB NIC discovering
@ 2023-11-22 23:50 Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 1/3] RedfishPkg: fix memory leak in HiiUtilityLib Mike Maslenkin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mike Maslenkin @ 2023-11-22 23:50 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork

This patch series involves the following changes:
1. fix memory leak and add explicit variable initialization in HiiUtilityLib
2. fix MAC address comparison during USB NIC discovering.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>


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

* [edk2-devel] [PATCH 1/3] RedfishPkg: fix memory leak in HiiUtilityLib
  2023-11-22 23:50 [edk2-devel] [PATCH 0/3] RedfishPkg: refine HiiUtilityLib and fix USB NIC discovering Mike Maslenkin
@ 2023-11-22 23:50 ` Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 2/3] RedfishPkg: add explicit variable initialization Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 3/3] RedfishPkg: fix searching for the BMC-exposed USB NIC Mike Maslenkin
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Maslenkin @ 2023-11-22 23:50 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c
index 168b4459844f..fd322c2086d8 100644
--- a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c
+++ b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.c
@@ -388,11 +388,13 @@ SetQuestionValue (
       Question->Value.BufferLen = Question->StorageWidth;
       Question->Value.Buffer    = AllocateZeroPool (Question->StorageWidth);
       if (Question->Value.Buffer == NULL) {
+        FreePool (TemString);
         return EFI_OUT_OF_RESOURCES;
       }
 
       CopyMem (Question->Value.Buffer, TemString, StrSize (TemString));
       Src = Question->Value.Buffer;
+      FreePool (TemString);
     } else {
       CopyMem (&Question->Value.Value, &QuestionValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
       Src = (UINT8 *)&Question->Value.Value;
-- 
2.32.0 (Apple Git-132)


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

* [edk2-devel] [PATCH 2/3] RedfishPkg: add explicit variable initialization
  2023-11-22 23:50 [edk2-devel] [PATCH 0/3] RedfishPkg: refine HiiUtilityLib and fix USB NIC discovering Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 1/3] RedfishPkg: fix memory leak in HiiUtilityLib Mike Maslenkin
@ 2023-11-22 23:50 ` Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 3/3] RedfishPkg: fix searching for the BMC-exposed USB NIC Mike Maslenkin
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Maslenkin @ 2023-11-22 23:50 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork

Ancient GCC 4.8.5 warned about variable may be unitialied.
And it doesn't look like false alarm.

The warning is:
edk2/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c: In function 'GetQuestionDefault':
edk2/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c:5519:6: error: 'ConfigAccess' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (ConfigAccess != NULL) {

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c
index 80b93beae999..b61b7f5fcdcc 100644
--- a/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c
+++ b/RedfishPkg/Library/HiiUtilityLib/HiiUtilityInternal.c
@@ -5451,6 +5451,7 @@ GetQuestionDefault (
 
   Status            = EFI_NOT_FOUND;
   StrValue          = NULL;
+  ConfigAccess      = NULL;
   OriginalDefaultId = DefaultId;
   DefaultLink       = GetFirstNode (&FormSet->DefaultStoreListHead);
 
-- 
2.32.0 (Apple Git-132)


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

* [edk2-devel] [PATCH 3/3] RedfishPkg: fix searching for the BMC-exposed USB NIC
  2023-11-22 23:50 [edk2-devel] [PATCH 0/3] RedfishPkg: refine HiiUtilityLib and fix USB NIC discovering Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 1/3] RedfishPkg: fix memory leak in HiiUtilityLib Mike Maslenkin
  2023-11-22 23:50 ` [edk2-devel] [PATCH 2/3] RedfishPkg: add explicit variable initialization Mike Maslenkin
@ 2023-11-22 23:50 ` Mike Maslenkin
  2 siblings, 0 replies; 4+ messages in thread
From: Mike Maslenkin @ 2023-11-22 23:50 UTC (permalink / raw)
  To: devel; +Cc: abner.chang, nicklew, igork

According to RedfishPkg/Readme.md document:
"The last byte of host-end USB NIC MAC address is the last byte of
BMC-end USB NIC MAC address minus 1."

It is necessary to subtract 1 from IpmiLanChannelMacAddress.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../PlatformHostInterfaceBmcUsbNicLib.c                       | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 95900579118b..20ec89d4fcb0 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -738,8 +738,8 @@ HostInterfaceIpmiCheckMacAddress (
              (VOID *)&IpmiLanChannelMacAddress.Addr,
              IpmiLanMacAddressSize - 1
              ) != 0) ||
-          (IpmiLanChannelMacAddress.Addr[IpmiLanMacAddressSize - 1] !=
-           *(UsbNicInfo->MacAddress + IpmiLanMacAddressSize - 1) - 1)
+          (IpmiLanChannelMacAddress.Addr[IpmiLanMacAddressSize - 1] - 1 !=
+           *(UsbNicInfo->MacAddress + IpmiLanMacAddressSize - 1))
           )
       {
         DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, "    MAC address is not matched.\n"));
-- 
2.32.0 (Apple Git-132)


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

end of thread, other threads:[~2023-11-22 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-22 23:50 [edk2-devel] [PATCH 0/3] RedfishPkg: refine HiiUtilityLib and fix USB NIC discovering Mike Maslenkin
2023-11-22 23:50 ` [edk2-devel] [PATCH 1/3] RedfishPkg: fix memory leak in HiiUtilityLib Mike Maslenkin
2023-11-22 23:50 ` [edk2-devel] [PATCH 2/3] RedfishPkg: add explicit variable initialization Mike Maslenkin
2023-11-22 23:50 ` [edk2-devel] [PATCH 3/3] RedfishPkg: fix searching for the BMC-exposed USB NIC Mike Maslenkin

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