Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ipmctl for openSUSE:Factory checked 
in at 2022-01-17 22:34:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ipmctl (Old)
 and      /work/SRC/openSUSE:Factory/.ipmctl.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ipmctl"

Mon Jan 17 22:34:21 2022 rev:13 rq:946984 version:03.00.00.0423

Changes:
--------
--- /work/SRC/openSUSE:Factory/ipmctl/ipmctl.changes    2021-12-17 
23:55:03.383556715 +0100
+++ /work/SRC/openSUSE:Factory/.ipmctl.new.1892/ipmctl.changes  2022-01-17 
22:35:11.394289186 +0100
@@ -1,0 +2,9 @@
+Mon Jan 17 13:29:39 UTC 2022 - r...@suse.com
+
+- Update to version 03.00.00.0423
+  - Add support for newer systems.  [bsc#1194354]
+  (For detailed changes see 'ChangeLog.xz')
+- Refresh patch(es)
+  (ipmctl-static-EDK2.patch.xz)
+
+-------------------------------------------------------------------
@@ -4 +13,2 @@
-- Update to version 03.00.00.0407  [jsc#SLE-18904, jsc#SLE-19429]
+- Update to version 03.00.00.0407
+  - Use recommended version.  [jsc#SLE-18904, jsc#SLE-19429]
@@ -28,2 +38 @@
-  - Sidestep feature process, hardware enablement via bugzilla.
-    [bsc#1162844]
+  - Add support for newer systems.  [bsc#1162844]

Old:
----
  ipmctl-03.00.00.0407.tar.gz

New:
----
  ipmctl-03.00.00.0423.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ipmctl.spec ++++++
--- /var/tmp/diff_new_pack.NAReJA/_old  2022-01-17 22:35:12.086289644 +0100
+++ /var/tmp/diff_new_pack.NAReJA/_new  2022-01-17 22:35:12.086289644 +0100
@@ -21,7 +21,7 @@
 %define vgit    %{nil}
 
 Name:           ipmctl
-Version:        03.00.00.0407
+Version:        03.00.00.0423
 Release:        0
 Summary:        Utility for managing Intel Optane persistent memory modules
 License:        BSD-3-Clause

++++++ ChangeLog.xz ++++++
--- /var/tmp/diff_new_pack.NAReJA/_old  2022-01-17 22:35:12.162289694 +0100
+++ /var/tmp/diff_new_pack.NAReJA/_new  2022-01-17 22:35:12.198289718 +0100
@@ -1,3 +1,195 @@
+commit c66b702fdd730086ac4577b88baf36b5afa7c910
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Wed Jan 5 09:02:54 2022 -0800
+
+    Update default version to 0423
+
+commit 9f90b22a088445239a3efb325058cc701d6fd898
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Thu Dec 9 00:50:46 2021 +0100
+
+    Remove file read from preferences write function
+    
+    I think it's just a copy paste error from when the code
+    was written originally.
+    
+    Additionally delete any symbolic links before writing.
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 10e1b3c0600e2be46f4c20f0456384238852e74b
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Sat Dec 4 00:09:08 2021 +0100
+
+    Free both new arrays if one fails to AllocatePool
+    
+    Also in this error condition, don't modify/free caller's table
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 92673aa281147cf519767661741d94094f303449
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Fri Dec 3 23:59:05 2021 +0100
+
+    Destroy mutex attr after use
+    
+    Make sure to set mutex to NULL if freed too.
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit edccaf896c29a7ace9b660e5a04e6acf7a71daf0
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Fri Dec 3 23:13:12 2021 +0100
+
+    Update documentation on security state limits on set passphrase
+    
+    Signed-off-by: Steven Pontsler <steven.ponts...@intel.com>
+
+commit dff5599df734c05b605ab82776c6c905c1d53743
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Fri Dec 3 22:12:08 2021 +0100
+
+    Make new ascii function for FreeStringArray
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 4577a980a3f4960c3b336dc9008f0849f9804489
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Fri Dec 3 21:09:12 2021 +0100
+
+    Add a missing free to the code
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 319edd1fe2c26ba52402ea0b73b1d701b8b2f24f
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Thu Dec 2 20:44:37 2021 +0100
+
+    Remove pImageBuffer pointer to avoid warning from static analyzer
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 67398c5fd6982a8a4ff75791eb627d96f8bc32e6
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Wed Dec 1 03:24:17 2021 +0100
+
+    Allow longer character sequences to yes/no question
+    
+    When the linux "yes" command is used, the sequence received
+    is "y\ny\ny\ny\n...", and this should be allowed.
+    
+    fixes #179
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 629561aa44e38711f1b426bd4ea3a5a08359cc62
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Tue Nov 30 21:39:39 2021 +0100
+
+    Remove potential dereference of NULL pDimmNode
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 12a62c7ded7058fa743316363326f03d487f035c
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Tue Nov 30 05:50:11 2021 +0100
+
+    Verify received ACPI table size
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit a65d2362739aac64af6ea706e780ce8e1e44ceb3
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Tue Nov 30 01:21:15 2021 +0100
+
+    Remove unused code
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 8edc1ce3ec843c5ce525f289806bc3f8786bf785
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Wed Dec 15 10:21:22 2021 -0800
+
+    Update default version to 0421
+
+commit 128b9ea3f05fbd1207fa0e9a473aba5e4120479e
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Tue Nov 23 02:23:51 2021 +0100
+
+    Change ordering for DDR5 to be less than PMem modules
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 2305e535c258c68a4fffb38ffab3aa85509e4e25
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Tue Dec 14 11:54:26 2021 -0800
+
+    Update default version to 0414
+
+commit e7dfc9ee6003ce37bce83f635482f41543538a2f
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Thu Nov 18 20:03:47 2021 +0100
+
+    Moving command status init earlier on show -error
+    
+    This avoids having a segfault occur because the command status
+    is not initialized yet when there is an invalid argument.
+    
+    I did some cursory checks of other commands using invalid
+    arguments and it doesn't seem to be a general issue.
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 69562eb2f4df036804edcc5816eb3d2e66a3293f
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Wed Nov 17 18:42:13 2021 +0100
+
+    Fix potential memory leak
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 3310873deff5114da1ba852ac5a223d87f9cd99f
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Mon Nov 15 20:45:44 2021 +0100
+
+    Provide a proper string length that isn't the buffer length
+    
+    If you have a bad SMBIOS string, then it can overrun the destination
+    buffer and wreak havoc on other data in pDimmInfo.
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
+commit 19933b18127b04d2ad92f4d9a7327eab7ba25429
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Tue Dec 14 10:56:49 2021 -0800
+
+    Update default version to 0412
+
+commit ce7f5bd78469bc7ca8063ff6ed63417d8f5030dc
+Author: Steven Pontsler <steven.ponts...@intel.com>
+Date:   Tue Dec 14 10:25:05 2021 -0800
+
+    Update default version to 0408
+
+commit 9ec259d8cb97d9eb2ae437487e79f82965c04659
+Author: Nolan Hergert <nolan.herg...@intel.com>
+Date:   Thu Nov 11 21:01:13 2021 +0100
+
+    Allow create goal to handle media disabled modules correctly
+    
+    Make ApplyGoalConfigsToDimms compatible with VerifyTargetDimms and have it
+    use the specified subset of PMem modules.
+    
+    Exclude media not accessible modules when we write out the PCD. The
+    existing code is not good practice, but rewriting the APIs would take
+    some time as well.
+    
+    Update a few commands to only use media accessible PMem modules. I 
confirmed
+    that the rest of the PCD-relevant commands they either used
+    REQUIRE_DCPMMS_MEDIA_ACCESSIBLE directly or a sub-routine used it.
+    
+    Signed-off-by: Nolan Hergert <nolan.herg...@intel.com>
+
 commit 24463af8125965475db714558fbce2fbb7e00835
 Author: Steven Pontsler <steven.ponts...@intel.com>
 Date:   Wed Nov 3 15:06:12 2021 -0700

++++++ ipmctl-03.00.00.0407.tar.gz -> ipmctl-03.00.00.0423.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/CMakeLists.txt 
new/ipmctl-03.00.00.0423/CMakeLists.txt
--- old/ipmctl-03.00.00.0407/CMakeLists.txt     2021-11-03 23:06:12.000000000 
+0100
+++ new/ipmctl-03.00.00.0423/CMakeLists.txt     2022-01-05 18:02:54.000000000 
+0100
@@ -46,7 +46,7 @@
   endif()
 
   if(NOT GIT_FOUND OR ${GIT_RETURN_CODE})
-    set(IPMCTL_VERSION_STRING 
${IPMCTL_VERSION_MAJOR}.${IPMCTL_VERSION_MINOR}.${IPMCTL_VERSION_PATCH}.0407)
+    set(IPMCTL_VERSION_STRING 
${IPMCTL_VERSION_MAJOR}.${IPMCTL_VERSION_MINOR}.${IPMCTL_VERSION_PATCH}.0423)
   endif()
 endif()
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/cli/ShowErrorCommand.c 
new/ipmctl-03.00.00.0423/DcpmPkg/cli/ShowErrorCommand.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/cli/ShowErrorCommand.c     2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/cli/ShowErrorCommand.c     2022-01-05 
18:02:54.000000000 +0100
@@ -249,6 +249,13 @@
   ZeroMem(ErrorsArray, sizeof(ErrorsArray));
   ZeroMem(DimmStr, sizeof(DimmStr));
 
+  ReturnCode = InitializeCommandStatus(&pCommandStatus);
+  if (EFI_ERROR(ReturnCode) || pCommandStatus == NULL) {
+    PRINTER_SET_MSG(pPrinterCtx, ReturnCode, FORMAT_STR_NL, 
CLI_ERR_INTERNAL_ERROR);
+    NVDIMM_DBG("Failed on InitializeCommandStatus");
+    goto Finish;
+  }
+
   if (pCmd == NULL) {
     ReturnCode = EFI_INVALID_PARAMETER;
     NVDIMM_DBG("pCmd parameter is NULL.\n");
@@ -303,13 +310,6 @@
     goto Finish;
   }
 
-  ReturnCode = InitializeCommandStatus(&pCommandStatus);
-  if (EFI_ERROR(ReturnCode) || pCommandStatus == NULL) {
-    PRINTER_SET_MSG(pPrinterCtx, ReturnCode, FORMAT_STR_NL, 
CLI_ERR_INTERNAL_ERROR);
-    NVDIMM_DBG("Failed on InitializeCommandStatus");
-    goto Finish;
-  }
-
   // Populate the list of DIMM_INFO structures with relevant information
   ReturnCode = GetAllDimmList(pNvmDimmConfigProtocol, pCmd, 
DIMM_INFO_CATEGORY_NONE, &pDimms, &DimmCount);
   if (EFI_ERROR(ReturnCode)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/common/FwUtility.c 
new/ipmctl-03.00.00.0423/DcpmPkg/common/FwUtility.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/common/FwUtility.c 2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/common/FwUtility.c 2022-01-05 
18:02:54.000000000 +0100
@@ -254,10 +254,12 @@
   UINT64 BuffSizeTemp = 0;
   UINT64 BuffSpiSize = sizeof(SpiDirectory);
   BOOLEAN VerifyNormalImage = FALSE;
-  VOID *pImageBuffer = NULL;
-
   NVDIMM_ENTRY();
 
+  CHECK_NULL_ARG(pFilePath, Finish);
+  CHECK_NULL_ARG(ppImageHeader, Finish);
+  CHECK_NULL_ARG(pCommandStatus, Finish);
+
   ZeroMem(&FileHandle, sizeof(FileHandle));
   ZeroMem(&SpiDirectory, sizeof(SpiDirectory));
 
@@ -337,9 +339,8 @@
     Fortunately our buffer will be smaller even if UINTN is 32-bit.
   **/
   BuffSize = sizeof(NVM_FW_IMAGE_HEADER);
-  pImageBuffer = AllocatePool(BuffSize);
-
-  if (pImageBuffer == NULL) {
+  *ppImageHeader = AllocatePool(BuffSize);
+  if (*ppImageHeader == NULL) {
     CatSPrintNCopy(pCommandStatus->StatusDetails, MAX_STATUS_DETAILS_STR_LEN,
         DETAILS_MEM_ALLOCATION_ERROR_FW_IMG);
     ReturnValue = FALSE;
@@ -366,12 +367,7 @@
     }
   }
 
-  ReturnCode = FileHandle->Read(FileHandle, &BuffSize, pImageBuffer);
-
-  /**
-    Cast the buffer to the header pointer, so we can read the image 
information.
-  **/
-  *ppImageHeader = (NVM_FW_IMAGE_HEADER *)pImageBuffer;
+  ReturnCode = FileHandle->Read(FileHandle, &BuffSize, *ppImageHeader);
 
   /**
     If the read function returned an error OR we read less bytes that the file 
length equals.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/common/NvmTypes.h 
new/ipmctl-03.00.00.0423/DcpmPkg/common/NvmTypes.h
--- old/ipmctl-03.00.00.0407/DcpmPkg/common/NvmTypes.h  2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/common/NvmTypes.h  2022-01-05 
18:02:54.000000000 +0100
@@ -271,6 +271,8 @@
 #define REQUIRE_DCPMMS_POPULATION_VIOLATION             (1 << 4)      // See 
IsDimmInPopulationViolation() for definition
 #define REQUIRE_DCPMMS_NO_POPULATION_VIOLATION          (1 << 5)      // See 
IsDimmInPopulationViolation() for definition
 #define REQUIRE_DCPMMS_NO_UNMAPPED_POPULATION_VIOLATION (1 << 6)      // See 
IsDimmInUnmappedPopulationViolation() for definition
+#define REQUIRE_DCPMMS_MEDIA_ACCESSIBLE                 (1 << 7)      // 
Select PMem modules where the media is accessible
+#define REQUIRE_DCPMMS_MEDIA_NOT_ACCESSIBLE             (1 << 8)      // 
Select PMem modules where the media is not accessible
 
 /* VFR compiler doesn't support typedef, that's why we use defines **/
 #define DIMM_INFO_CATEGORIES        UINT16                          ///< @ref 
DIMM_INFO_CATEGORY_TYPES
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/common/Utility.c 
new/ipmctl-03.00.00.0423/DcpmPkg/common/Utility.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/common/Utility.c   2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/common/Utility.c   2022-01-05 
18:02:54.000000000 +0100
@@ -611,7 +611,7 @@
 
   /** Error path **/
 FinishCleanMemory:
-  FreeStringArray((CHAR16**)ppArray, *pArraySize);
+  FreeStringArrayAscii(ppArray, *pArraySize);
   ppArray = NULL;
   *pArraySize = 0;
 
@@ -633,6 +633,31 @@
   IN     UINT32 ArraySize
   )
 {
+  UINT32 Index = 0;
+
+  if (ppStringArray == NULL) {
+    return;
+  }
+
+  for (Index = 0; Index < ArraySize; Index++) {
+    FREE_POOL_SAFE(ppStringArray[Index]);
+  }
+
+  FreePool(ppStringArray);
+}
+
+/**
+  Copy of FreeStringArray, used for avoiding static code analysis complaint
+
+  @param[in,out] ppStringArray array of strings
+  @param[in] ArraySize number of strings
+**/
+VOID
+FreeStringArrayAscii(
+  IN OUT CHAR8 **ppStringArray,
+  IN     UINT32 ArraySize
+  )
+{
   UINT32 Index = 0;
 
   if (ppStringArray == NULL) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/common/Utility.h 
new/ipmctl-03.00.00.0423/DcpmPkg/common/Utility.h
--- old/ipmctl-03.00.00.0407/DcpmPkg/common/Utility.h   2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/common/Utility.h   2022-01-05 
18:02:54.000000000 +0100
@@ -719,6 +719,7 @@
 
 /**
   First free elements of array and then free the array
+  This does NOT set pointer to array to NULL
 
   @param[in,out] ppStringArray array of strings
   @param[in] ArraySize number of strings
@@ -730,6 +731,19 @@
   );
 
 /**
+  Copy of FreeStringArray, used for avoiding static code analysis complaint
+
+  @param[in,out] ppStringArray array of strings
+  @param[in] ArraySize number of strings
+**/
+VOID
+FreeStringArrayAscii(
+  IN OUT CHAR8 **ppStringArray,
+  IN     UINT32 ArraySize
+  );
+
+
+/**
   Open the specified protocol.
   If the user does not provide a handle, the function will try
   to match the driver or the controller handle based on the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Dimm.c 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Dimm.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Dimm.c 2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Dimm.c 2022-01-05 
18:02:54.000000000 +0100
@@ -7373,12 +7373,15 @@
 
   if (NULL != gNvmDimmData) {
     LIST_FOR_EACH(pDimmNode, &gNvmDimmData->PMEMDev.Dimms) {
-      if (NULL != pDimmNode) {
-        pDimm = DIMM_FROM_NODE(pDimmNode);
-        if (NULL != pDimm) {
-          // Free memory and set to NULL so won't be used by Get PCD calls
-          FREE_POOL_SAFE(pDimm->pPcdOem);
-        }
+      if (pDimmNode == NULL) {
+        // Not supposed to get a NULL pDimmNode, but just in case
+        // exit out so we can't dereference it
+        break;
+      }
+      pDimm = DIMM_FROM_NODE(pDimmNode);
+      if (NULL != pDimm) {
+        // Free memory and set to NULL so won't be used by Get PCD calls
+        FREE_POOL_SAFE(pDimm->pPcdOem);
       }
     }
   }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Region.c 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Region.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Region.c       2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Region.c       2022-01-05 
18:02:54.000000000 +0100
@@ -1848,8 +1848,8 @@
       pDimm = DIMM_FROM_NODE(pDimmNode);
 
       if (Socket == pDimm->SocketId) {
-        // Unmanageable and non-functional DCPMMs are not included in goal 
requests
-        if (!IsDimmManageable(pDimm) || pDimm->NonFunctional) {
+        // Unmanageable, non-functional, and media inaccessible DCPMMs are not 
included in goal requests
+        if (!IsDimmManageable(pDimm) || pDimm->NonFunctional || 
DIMM_MEDIA_NOT_ACCESSIBLE(pDimm->BootStatusBitmask)) {
           continue;
         }
         // Population Violation DCPMMs are not included in goal requests 
except ADx1 100%
@@ -3816,27 +3816,26 @@
 **/
 EFI_STATUS
 ApplyGoalConfigsToDimms(
-  IN     LIST_ENTRY *pDimmList,
+  IN     DIMM **ppDimms,
+  IN     UINT32 DimmsNum,
      OUT COMMAND_STATUS *pCommandStatus
   )
 {
   EFI_STATUS ReturnCode = EFI_SUCCESS;
   DIMM *pDimm = NULL;
-  LIST_ENTRY *pDimmNode = NULL;
   NVDIMM_PLATFORM_CONFIG_INPUT *pNewConfigInput = NULL;
+  UINT32 Index = 0;
 
   NVDIMM_ENTRY();
 
-  if (pDimmList == NULL) {
-    ReturnCode = EFI_INVALID_PARAMETER;
-    goto Finish;
-  }
+  CHECK_NULL_ARG(ppDimms, Finish);
 
   /**
     Clear previous regions goal configs
   **/
-  LIST_FOR_EACH(pDimmNode, pDimmList) {
-    pDimm = DIMM_FROM_NODE(pDimmNode);
+  for (Index = 0; Index < DimmsNum; Index++) {
+    pDimm = ppDimms[Index];
+
     if (!IsDimmManageable(pDimm)) {
       continue;
     }
@@ -3855,8 +3854,9 @@
   /**
     Send new regions goal configs to dimms
   **/
-  LIST_FOR_EACH(pDimmNode, pDimmList) {
-    pDimm = DIMM_FROM_NODE(pDimmNode);
+  for (Index = 0; Index < DimmsNum; Index++) {
+    pDimm = ppDimms[Index];
+
     if (!IsDimmManageable(pDimm) || !pDimm->RegionsGoalConfig) {
       continue;
     }
@@ -3881,8 +3881,9 @@
   /**
     If all data has been sent to dimms successfully, then we are synchronized
   **/
-  LIST_FOR_EACH(pDimmNode, pDimmList) {
-    pDimm = DIMM_FROM_NODE(pDimmNode);
+  for (Index = 0; Index < DimmsNum; Index++) {
+    pDimm = ppDimms[Index];
+
     if (!IsDimmManageable(pDimm)) {
       continue;
     }
@@ -3897,8 +3898,9 @@
 Finish:
   if (EFI_ERROR(ReturnCode) && (EFI_INVALID_PARAMETER != ReturnCode)) {
     // Create Goal ERROR! Try to remove Configuration Input table from 
Platform Config Data
-    LIST_FOR_EACH(pDimmNode, pDimmList) {
-      pDimm = DIMM_FROM_NODE(pDimmNode);
+    for (Index = 0; Index < DimmsNum; Index++) {
+      pDimm = ppDimms[Index];
+
       if (!IsDimmManageable(pDimm)) {
         continue;
       }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Region.h 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Region.h
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Core/Region.h       2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Core/Region.h       2022-01-05 
18:02:54.000000000 +0100
@@ -381,7 +381,8 @@
 **/
 EFI_STATUS
 ApplyGoalConfigsToDimms(
-  IN     LIST_ENTRY *pDimmList,
+  IN     DIMM **ppDimms,
+  IN     UINT32 DimmsNum,
      OUT COMMAND_STATUS *pCommandStatus
   );
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ipmctl-03.00.00.0407/DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c     
2021-11-03 23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Protocol/Driver/NvmDimmConfig.c     
2022-01-05 18:02:54.000000000 +0100
@@ -599,21 +599,21 @@
 
     TempReturnCode = GetSmbiosString((SMBIOS_STRUCTURE_POINTER *) 
&(DmiPhysicalDev.Type17),
       DmiPhysicalDev.Type17->DeviceLocator,
-      pDimmInfo->DeviceLocator, sizeof(pDimmInfo->DeviceLocator));
+      pDimmInfo->DeviceLocator, DEVICE_LOCATOR_LEN);
     if (EFI_ERROR(TempReturnCode)) {
       StrnCpyS(pDimmInfo->DeviceLocator, DEVICE_LOCATOR_LEN, 
SMBIOS_STR_UNKNOWN, StrLen(SMBIOS_STR_UNKNOWN));
       NVDIMM_WARN("Failed to retrieve the device locator from SMBIOS table (" 
FORMAT_EFI_STATUS ")", ReturnCode);
     }
     TempReturnCode = GetSmbiosString((SMBIOS_STRUCTURE_POINTER *) 
&(DmiPhysicalDev.Type17),
       DmiPhysicalDev.Type17->BankLocator,
-      pDimmInfo->BankLabel, sizeof(pDimmInfo->BankLabel));
+      pDimmInfo->BankLabel, BANKLABEL_LEN);
     if (EFI_ERROR(TempReturnCode)) {
       StrnCpyS(pDimmInfo->BankLabel, BANKLABEL_LEN, SMBIOS_STR_UNKNOWN, 
StrLen(SMBIOS_STR_UNKNOWN));
       NVDIMM_WARN("Failed to retrieve the bank locator from SMBIOS table (" 
FORMAT_EFI_STATUS ")", ReturnCode);
     }
     TempReturnCode = GetSmbiosString((SMBIOS_STRUCTURE_POINTER *) 
&(DmiPhysicalDev.Type17),
       DmiPhysicalDev.Type17->Manufacturer,
-      pDimmInfo->ManufacturerStr, sizeof(pDimmInfo->ManufacturerStr));
+      pDimmInfo->ManufacturerStr, MANUFACTURER_LEN);
     if (EFI_ERROR(TempReturnCode)) {
       StrnCpyS(pDimmInfo->ManufacturerStr, MANUFACTURER_LEN, 
SMBIOS_STR_UNKNOWN, StrLen(SMBIOS_STR_UNKNOWN));
       NVDIMM_WARN("Failed to retrieve the manufacturer string from SMBIOS 
table (" FORMAT_EFI_STATUS ")", ReturnCode);
@@ -1401,6 +1401,15 @@
     Allowed = FALSE;
   }
 
+  // Verify the mutually exclusive REQUIRE_DCPMMS_MEDIA_ACCESSIBLE and 
REQUIRE_DCPMMS_MEDIA_NOT_ACCESSIBLE flags are not both set
+  ASSERT(!((REQUIRE_DCPMMS_MEDIA_ACCESSIBLE & RequireDcpmmsBitfield) && 
(REQUIRE_DCPMMS_MEDIA_NOT_ACCESSIBLE & RequireDcpmmsBitfield)));
+  if ((REQUIRE_DCPMMS_MEDIA_ACCESSIBLE & RequireDcpmmsBitfield) && 
DIMM_MEDIA_NOT_ACCESSIBLE(pDimm->BootStatusBitmask)) {
+    Allowed = FALSE;
+  }
+  if ((REQUIRE_DCPMMS_MEDIA_NOT_ACCESSIBLE & RequireDcpmmsBitfield) && 
!DIMM_MEDIA_NOT_ACCESSIBLE(pDimm->BootStatusBitmask)) {
+    Allowed = FALSE;
+  }
+
   return Allowed;
 }
 
@@ -2438,7 +2447,7 @@
   //Try to calculate appdirect index for all regional goals for all dimms in 
advance
   PopulateAppDirectIndex(NumberedGoals, &NumberedGoalsNum, &AppDirectIndex);
   ReturnCode = VerifyTargetDimms(pDimmIds, DimmIdsCount, pSocketIds, 
SocketIdsCount,
-      REQUIRE_DCPMMS_MANAGEABLE | REQUIRE_DCPMMS_FUNCTIONAL,
+      REQUIRE_DCPMMS_MANAGEABLE | REQUIRE_DCPMMS_FUNCTIONAL | 
REQUIRE_DCPMMS_MEDIA_ACCESSIBLE,
       pDimms, &DimmsCount, pCommandStatus);
   if (EFI_ERROR(ReturnCode) || pCommandStatus->GeneralStatus != 
NVM_ERR_OPERATION_NOT_STARTED) {
     if (ReturnCode == EFI_NOT_FOUND && pCommandStatus->GeneralStatus == 
NVM_ERR_NO_USABLE_DIMMS) {
@@ -5871,30 +5880,6 @@
     return ReturnCode;
   }
 
-
-EFI_STATUS
-ReturnErrorWithMediaDisabledPMemModule(
-    OUT COMMAND_STATUS *pCommandStatus
-  )
-{
-  EFI_STATUS ReturnCode = EFI_SUCCESS;
-  LIST_ENTRY *pDimmNode = NULL;
-  DIMM *pDimm = NULL;
-
-  // Because of the difficulties in refactoring the create goal code
-  // (specifically Region.c) to work with a media disabled PMem module,
-  // error out with a requirement that the user replace the module.
-  LIST_FOR_EACH(pDimmNode, &gNvmDimmData->PMEMDev.Dimms) {
-    pDimm = DIMM_FROM_NODE(pDimmNode);
-    if (DIMM_MEDIA_NOT_ACCESSIBLE(pDimm->BootStatusBitmask)) {
-      // Want to set an error for each module
-      SetObjStatusForDimm(pCommandStatus, pDimm, 
NVM_ERR_MEDIA_NOT_ACCESSIBLE_CANNOT_CONTINUE);
-      ReturnCode = EFI_UNSUPPORTED;
-    }
-  }
-  return ReturnCode;
-}
-
 /**
   Get actual Region goal capacities that would be used based on input values.
 
@@ -5964,12 +5949,10 @@
   MAX_PMINTERLEAVE_SETS MaxPMInterleaveSets;
   ACPI_REVISION PcatRevision;
   BOOLEAN IsDimmUnlocked = FALSE;
-  REQUIRE_DCPMMS RequireDcpmmsBitfield = REQUIRE_DCPMMS_MANAGEABLE | 
REQUIRE_DCPMMS_FUNCTIONAL;
+  REQUIRE_DCPMMS RequireDcpmmsBitfield = REQUIRE_DCPMMS_MANAGEABLE | 
REQUIRE_DCPMMS_FUNCTIONAL | REQUIRE_DCPMMS_MEDIA_ACCESSIBLE;
 
   NVDIMM_ENTRY();
 
-  CHECK_RESULT(ReturnErrorWithMediaDisabledPMemModule(pCommandStatus), Finish);
-
   ZeroMem(RegionGoalTemplates, sizeof(RegionGoalTemplates));
   ZeroMem(&MaxPMInterleaveSets, sizeof(MaxPMInterleaveSets));
   ZeroMem(&PcatRevision, sizeof(PcatRevision));
@@ -6330,12 +6313,10 @@
   BOOLEAN SmbusMailboxOnList = FALSE;
   BOOLEAN SmbusWillNotBeUsed = FALSE;
   DIMM_PASSTHRU_METHOD Method = DimmPassthruDdrtLargePayload;
-  REQUIRE_DCPMMS RequireDcpmmsBitfield = REQUIRE_DCPMMS_MANAGEABLE | 
REQUIRE_DCPMMS_FUNCTIONAL;
+  REQUIRE_DCPMMS RequireDcpmmsBitfield = REQUIRE_DCPMMS_MANAGEABLE | 
REQUIRE_DCPMMS_FUNCTIONAL | REQUIRE_DCPMMS_MEDIA_ACCESSIBLE;
 
   NVDIMM_ENTRY();
 
-  CHECK_RESULT(ReturnErrorWithMediaDisabledPMemModule(pCommandStatus), Finish);
-
   ZeroMem(RegionGoalTemplates, sizeof(RegionGoalTemplates));
   ZeroMem(&DriverPreferences, sizeof(DriverPreferences));
   ZeroMem(&MaxPMInterleaveSets, sizeof(MaxPMInterleaveSets));
@@ -6684,7 +6665,7 @@
     SetCmdStatus(pCommandStatus, NVM_SUCCESS);
   } else {
     /** Send Platform Config Data to DIMMs **/
-    ReturnCode = ApplyGoalConfigsToDimms(&gNvmDimmData->PMEMDev.Dimms, 
pCommandStatus);
+    ReturnCode = ApplyGoalConfigsToDimms(ppDimms, DimmsNum, pCommandStatus);
 
     if (EFI_ERROR(ReturnCode)) {
       NVDIMM_DBG("ApplyGoalConfigsToDimms Error");
@@ -6762,7 +6743,8 @@
   /** Verify input parameters and determine a list of DIMMs **/
   ReturnCode = VerifyTargetDimms(pDimmIds, DimmIdsCount, pSocketIds, 
SocketIdsCount,
       REQUIRE_DCPMMS_MANAGEABLE |
-      REQUIRE_DCPMMS_FUNCTIONAL,
+      REQUIRE_DCPMMS_FUNCTIONAL |
+      REQUIRE_DCPMMS_MEDIA_ACCESSIBLE,
       pDimms, &DimmsNum, pCommandStatus);
   if (EFI_ERROR(ReturnCode) || pCommandStatus->GeneralStatus != 
NVM_ERR_OPERATION_NOT_STARTED) {
     goto Finish;
@@ -6805,7 +6787,7 @@
   }
 
   /** Send Platform Config Data to DIMMs **/
-  ReturnCode = ApplyGoalConfigsToDimms(&gNvmDimmData->PMEMDev.Dimms, 
pCommandStatus);
+  ReturnCode = ApplyGoalConfigsToDimms(pDimms, DimmsNum, pCommandStatus);
   if (EFI_ERROR(ReturnCode)) {
     goto Finish;
   }
@@ -7005,13 +6987,12 @@
   }
 
   CHECK_RESULT(BlockMixedSku(pCommandStatus), Finish);
-  CHECK_RESULT(ReturnErrorWithMediaDisabledPMemModule(pCommandStatus), Finish);
 
 
   ReturnCode = VerifyTargetDimms(pDimmIds, DimmIdsCount, pSocketIds, 
SocketIdsCount,
       REQUIRE_DCPMMS_MANAGEABLE |
       REQUIRE_DCPMMS_FUNCTIONAL |
-      REQUIRE_DCPMMS_NO_POPULATION_VIOLATION,
+      REQUIRE_DCPMMS_MEDIA_ACCESSIBLE,
       pDimms, &DimmsNum, pCommandStatus);
   if (EFI_ERROR(ReturnCode) || pCommandStatus->GeneralStatus != 
NVM_ERR_OPERATION_NOT_STARTED) {
     goto Finish;
@@ -9409,12 +9390,13 @@
 }
 
 /**
-  Sorts the Dimm topology list by Memory Type
+  Sorts the Dimm topology list by Memory Type. Promote PMem modules (type 2)
+  over DDR4 and DDR5 memory.
 
   @param[in out] pMemType1 A pointer to the pDimmId list.
   @param[in out] pMemType2 A pointer to the copy of pDimmId list.
 
-  @retval int returns 0,-1, 0
+  @retval int returns 1,-1, 0
 **/
 INT32 SortDimmTopologyByMemType(VOID *ppTopologyDimm1, VOID *ppTopologyDimm2)
 {
@@ -9423,6 +9405,13 @@
   if (ppTopologyDimma->MemoryType == ppTopologyDimmb->MemoryType) {
     return 0;
   }
+  // Promote PMem modules (2) over DDR4 (1) and DDR5 (3)
+  else if (ppTopologyDimmb->MemoryType == MEMORYTYPE_DCPM) {
+    return 1;
+  }
+  else if (ppTopologyDimma->MemoryType == MEMORYTYPE_DCPM) {
+    return -1;
+  }
   else if (ppTopologyDimma->MemoryType < ppTopologyDimmb->MemoryType) {
     return 1;
   }
@@ -10812,6 +10801,7 @@
           SetObjStatusForDimm(pCommandStatus, pDimms[Index], NVM_SUCCESS);
           FREE_POOL_SAFE(pPayloadPackageSparingPolicy);
       }
+      FREE_POOL_SAFE(pPayloadPackageSparingPolicy);
       break;
     case ERROR_INJ_DIRTY_SHUTDOWN:
       pInputPayload = 
AllocateZeroPool(sizeof(PT_INPUT_PAYLOAD_INJECT_SW_TRIGGERS));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ipmctl-03.00.00.0407/DcpmPkg/driver/Utils/AcpiParsing.c 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Utils/AcpiParsing.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Utils/AcpiParsing.c 2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Utils/AcpiParsing.c 2022-01-05 
18:02:54.000000000 +0100
@@ -1381,6 +1381,8 @@
   pData = AllocatePool(DataSize);
 
   if (ppNewTable == NULL || pData == NULL) {
+    FREE_POOL_SAFE(ppNewTable);
+    FREE_POOL_SAFE(pData);
     NVDIMM_DBG("Could not allocate the memory.");
     goto Finish;
   }
@@ -1398,9 +1400,11 @@
 
   (*pNewPointerIndex)++; // Increment the array index
 
-Finish:
+  // Only free caller's original table (ppTable) if we succeed
+  // If we don't succeed, we'll return NULL below
   FREE_POOL_SAFE(ppTable);
 
+Finish:
   return ppNewTable;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ipmctl-03.00.00.0407/DcpmPkg/driver/Utils/SmbiosUtility.c 
new/ipmctl-03.00.00.0423/DcpmPkg/driver/Utils/SmbiosUtility.c
--- old/ipmctl-03.00.00.0407/DcpmPkg/driver/Utils/SmbiosUtility.c       
2021-11-03 23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/DcpmPkg/driver/Utils/SmbiosUtility.c       
2022-01-05 18:02:54.000000000 +0100
@@ -75,7 +75,7 @@
   @param[in]  pSmbios         Pointer to SMBIOS structure.
   @param[in]  StringNumber    String number to return.
   @param[out] pSmbiosString   Pointer to a char buffer to where SMBIOS string 
will be copied.
-  @param[in]  BufferLen       pSmbiosString buffer length
+  @param[in]  BufferStrLen    pSmbiosString buffer string length (number of 
characters)
 
   @retval EFI_SUCCESS String retrieved successfully
   @retval EFI_INVALID_PARAMETER
@@ -86,7 +86,7 @@
   IN     SMBIOS_STRUCTURE_POINTER *pSmbios,
   IN     UINT16                    StringNumber,
      OUT CHAR16                    *pSmbiosString,
-  IN     UINT16                    BufferLen
+  IN     UINT16                    BufferStrLen
   )
 {
   UINT16  Index;
@@ -99,7 +99,7 @@
     ReturnCode = EFI_INVALID_PARAMETER;
     goto Finish;
   }
-  if (BufferLen == 0 && StringNumber != SMBIOS_STRING_INVALID) {
+  if (BufferStrLen == 0 && StringNumber != SMBIOS_STRING_INVALID) {
     ReturnCode = EFI_INVALID_PARAMETER;
     goto Finish;
   }
@@ -110,11 +110,11 @@
   /** Look through unformatted section **/
   for (Index = 1; Index <= StringNumber; Index++) {
     if (StringNumber == Index) {
-      if (AsciiStrLen(pString) > (BufferLen * sizeof(CHAR16))) {
+      if (AsciiStrLen(pString) > (BufferStrLen * sizeof(CHAR16))) {
         ReturnCode = EFI_INVALID_PARAMETER;
         goto Finish;
       }
-      AsciiStrToUnicodeStrS(pString, pSmbiosString, BufferLen);
+      AsciiStrToUnicodeStrS(pString, pSmbiosString, BufferStrLen);
       ReturnCode = EFI_SUCCESS;
       goto Finish;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ipmctl-03.00.00.0407/Documentation/ipmctl/Memory_Subsystem_Provisioning/ipmctl-set-dimm-passphrase.txt
 
new/ipmctl-03.00.00.0423/Documentation/ipmctl/Memory_Subsystem_Provisioning/ipmctl-set-dimm-passphrase.txt
--- 
old/ipmctl-03.00.00.0407/Documentation/ipmctl/Memory_Subsystem_Provisioning/ipmctl-set-dimm-passphrase.txt
  2021-11-03 23:06:12.000000000 +0100
+++ 
new/ipmctl-03.00.00.0423/Documentation/ipmctl/Memory_Subsystem_Provisioning/ipmctl-set-dimm-passphrase.txt
  2022-01-05 18:02:54.000000000 +0100
@@ -138,14 +138,13 @@
 
 * The caller must have the appropriate privileges.
 
-* The specified PMem module must be manageable by the host software and
-  be in the "Disabled" lock state.
+* The specified PMem module must be manageable by the host software.
 
-* To change the passphrase, the specified PMem module must not be in the
- "Frozen" or "Exceeded" lock states.
+* To change the passphrase, the specified PMem module must be "Unlocked" and
+ not be in the "Frozen" or "Exceeded" lock states.
 
-* To change the master passphrase, the specified PMem module must not
-  be in "MP Exceeded" lock state.
+* To change the master passphrase, the specified PMem module must be in the
+ "Disabled" lock state and not be in "MP Exceeded" lock state.
 
 ifdef::os_build[]
 Command is subject to OS Vendor (OSV) support. If OSV does not provide support,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/efi_shim/os_efi_api_io.c 
new/ipmctl-03.00.00.0423/src/os/efi_shim/os_efi_api_io.c
--- old/ipmctl-03.00.00.0407/src/os/efi_shim/os_efi_api_io.c    2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/efi_shim/os_efi_api_io.c    2022-01-05 
18:02:54.000000000 +0100
@@ -415,8 +415,9 @@
     goto Finish;
   }
 
-  ValidInput = readSize == 2 &&
-    (buf[0] == 'y' || buf[0] == 'n');
+  ValidInput =
+      ( (buf[0] == 'y' && (buf[1] == '\0' || buf[1] == '\n')) ||
+        (buf[0] == 'n' && (buf[1] == '\0' || buf[1] == '\n')) );
   if (!ValidInput) {
     ReturnCode = EFI_INVALID_PARAMETER;
     goto Finish;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/efi_shim/win_efi_api.c 
new/ipmctl-03.00.00.0423/src/os/efi_shim/win_efi_api.c
--- old/ipmctl-03.00.00.0407/src/os/efi_shim/win_efi_api.c      2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/efi_shim/win_efi_api.c      2022-01-05 
18:02:54.000000000 +0100
@@ -11,6 +11,9 @@
 #include <win_scm2_passthrough.h>
 #include <NvmDimmDriver.h>
 
+#define SIZE_16MB   0x01000000
+#define MAX_FILE_SIZE_WINDOWS SIZE_16MB
+
 extern NVMDIMMDRIVER_DATA *gNvmDimmData;
 
 extern UINT32 win_scm2_ioctl_get_system_table(
@@ -145,6 +148,10 @@
   {
     return EFI_END_OF_FILE;
   }
+  else if (buf_size > MAX_FILE_SIZE_WINDOWS)
+  {
+    return EFI_BAD_BUFFER_SIZE;
+  }
 
   *table = AllocatePool(buf_size);
   if (NULL == *table)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/ini/ini.c 
new/ipmctl-03.00.00.0423/src/os/ini/ini.c
--- old/ipmctl-03.00.00.0407/src/os/ini/ini.c   2021-11-03 23:06:12.000000000 
+0100
+++ new/ipmctl-03.00.00.0423/src/os/ini/ini.c   2022-01-05 18:02:54.000000000 
+0100
@@ -52,7 +52,7 @@
 means we have either token only or end of line or nothing.
 An extra byte is for terminating zero purpose.
 */
-#define NVM_INI_CALLOC(size) (size > 0) ? (char *) calloc(1, size+1) : NULL 
+#define NVM_INI_CALLOC(size) (size > 0) ? (char *) calloc(1, size+1) : NULL
 
 /**
 @brief Allocate memory and initialize it to zero; if the size is 1 or less
@@ -452,11 +452,19 @@
     return 0;
   }
 
-  // Open and truncated the file
-  // Try to open the file
   snprintf(ini_path_filename, sizeof(ini_path_filename), "%s", 
p_ini_file_name);
-  h_file = fopen(ini_path_filename, "r");
-  if ((NULL == h_file) || (NULL == (h_file = freopen(ini_path_filename, "w", 
h_file)))) {
+  // Delete any symbolic link that might exist first
+  // so we don't overwrite an important admin-only file
+  // that might be linked maliciously.
+  // Don't need to do it for AppData as it's a protected directory.
+#if defined(__LINUX__) || defined(__ESX__)
+  unlink(ini_path_filename);
+#else
+  _unlink(ini_path_filename);
+#endif
+  // Open and truncate the existing file
+  h_file = fopen(ini_path_filename, "w");
+  if ((NULL == h_file)) {
     if (force_file_update) {
       snprintf(ini_path_filename, sizeof(ini_path_filename), "%s%s", 
APP_DATA_FILE_PATH, INI_INSTALL_FILEPATH);
       os_mkdir(ini_path_filename);
@@ -465,9 +473,9 @@
     }
     else {
       snprintf(ini_path_filename, sizeof(ini_path_filename), "%s%s%s", 
APP_DATA_FILE_PATH, INI_INSTALL_FILEPATH, p_ini_file_name);
-      h_file = fopen(ini_path_filename, "r");
+      h_file = fopen(ini_path_filename, "w");
     }
-    if ((NULL == h_file) || (NULL == (h_file = freopen(ini_path_filename, "w", 
h_file)))) {
+    if ((NULL == h_file)) {
       // Hardcoded data used, nothing to save
       return -1;
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/linux/lnx_acpi.c 
new/ipmctl-03.00.00.0423/src/os/linux/lnx_acpi.c
--- old/ipmctl-03.00.00.0407/src/os/linux/lnx_acpi.c    2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/linux/lnx_acpi.c    2022-01-05 
18:02:54.000000000 +0100
@@ -19,6 +19,8 @@
 #define        SYSFS_ACPI_PATH "/sys/firmware/acpi/tables/"
 int g_count = 0;
 
+#define MAX_FILE_SIZE_LINUX SIZE_16MB
+
 /*!
 * 8 bit unsigned integer as a boolean
 */
@@ -109,7 +111,8 @@
                size_t header_size = sizeof (header);
 
                ssize_t hdr_bytes_read = read(fd, &header, header_size);
-               if (hdr_bytes_read != header_size)
+               // Check total_table_size
+               if (hdr_bytes_read != header_size || header.length > 
MAX_FILE_SIZE_LINUX)
                {
                        rc = ACPI_ERR_BADTABLE;
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/linux/lnx_system.c 
new/ipmctl-03.00.00.0423/src/os/linux/lnx_system.c
--- old/ipmctl-03.00.00.0407/src/os/linux/lnx_system.c  2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/linux/lnx_system.c  2022-01-05 
18:02:54.000000000 +0100
@@ -31,8 +31,8 @@
 #include <nvm_management.h>
 
 #define        LOCALE_DIR      "/usr/share/locale"
-#define FTOK_PROJ_ID 'R' // Today proj_id is an int, but still only 8 bits are 
used. 
-                        // Typical usage has an ASCII character proj_id, 
+#define FTOK_PROJ_ID 'R' // Today proj_id is an int, but still only 8 bits are 
used.
+                        // Typical usage has an ASCII character proj_id,
                         // that is why the behavior is said to be undefined 
when proj_id is zero.
 #define SHM_PERM_FLG 0666 // permissions granted to the owner, group, and 
others.
 
@@ -72,77 +72,11 @@
 }
 
 /*
- * Blocks for the specified number of msecs.
- */
-void os_sleep(unsigned long time)
-{
-       unsigned long time_msec = time % 1000;
-       struct timespec ts;
-       ts.tv_sec = (time_t)((time - time_msec)/1000);
-       ts.tv_nsec = (long)(time_msec * 1000000);
-       nanosleep(&ts, NULL);
-}
-
-
-/*
- * Start a process
- */
-int os_start_process(const char *process_name, unsigned int *p_process_id)
-{
-       int rc = -1;
-
-       pid_t new_process = fork();
-       if (new_process == 0)
-       {
-               // By normal conventions arg0 should point to the program being 
executed.
-               execl(process_name, process_name, NULL);
-       }
-       else if (new_process > 0)
-       {
-               rc = 0;
-               *p_process_id = new_process;
-       }
-       return rc;
-}
-
-/*
- * Stop a process
- */
-int os_stop_process(unsigned int process_id)
-{
-       int rc = -1;
-       if (kill(process_id, SIGKILL) == 0)
-       {
-               rc = 0;
-       }
-       return rc;
-}
-
-/*
- * Create a thread on the current process
- */
-void os_create_thread(unsigned long long *p_thread_id, void *(*callback)(void 
*), void *callback_arg)
-{
-       pthread_create(
-                       (pthread_t *)p_thread_id,
-                       NULL, // default attributes
-                       callback,
-                       callback_arg);
-}
-
-/*
- * Retrieve the id of the current thread
- */
-unsigned long long os_get_thread_id()
-{
-       return (unsigned long long)pthread_self();
-}
-
-/*
  * Initializes a mutex.
  */
 OS_MUTEX * os_mutex_init(const char *name)
 {
+       int rc = 0;
        pthread_mutex_t *mutex = (pthread_mutex_t *) 
malloc(sizeof(pthread_mutex_t));
        if (mutex)
        {
@@ -169,17 +103,15 @@
                }
 
                // failure when pthread_mutex_init(..) != 0
-               if (0 == pthread_mutex_init((pthread_mutex_t *)mutex, &attr))
-               {
-                       return mutex;
+               rc = pthread_mutex_init((pthread_mutex_t *)mutex, &attr);
+               if (rc != 0) {
+                       free(mutex);
+                       mutex = NULL;
                }
-    else
-    {
-      pthread_mutexattr_destroy(&attr);
-      free(mutex);
-    }
+               // No longer need attr in success and failure case
+               pthread_mutexattr_destroy(&attr);
        }
-       return NULL;
+       return mutex;
 }
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ipmctl-03.00.00.0407/src/os/nvm_api/nvm_output_parsing.c 
new/ipmctl-03.00.00.0423/src/os/nvm_api/nvm_output_parsing.c
--- old/ipmctl-03.00.00.0407/src/os/nvm_api/nvm_output_parsing.c        
2021-11-03 23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/nvm_api/nvm_output_parsing.c        
2022-01-05 18:02:54.000000000 +0100
@@ -643,6 +643,7 @@
       {
          output_to_esx_xml_results(fd);
       }
+      free(dictionaries);
       return 0;
    }
    else if (DiagView == type)
@@ -681,7 +682,7 @@
             cur_dict = &dictionaries[num_dictionaries];
             ++num_dictionaries;
          }
-        
+
          state = NULL;
          tok = os_wcstok(trimmed_line, KEY_VALUE_TOK_DELIM, &state);
          if (tok == NULL)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/os.h 
new/ipmctl-03.00.00.0423/src/os/os.h
--- old/ipmctl-03.00.00.0407/src/os/os.h        2021-11-03 23:06:12.000000000 
+0100
+++ new/ipmctl-03.00.00.0423/src/os/os.h        2022-01-05 18:02:54.000000000 
+0100
@@ -73,12 +73,6 @@
 extern char * os_get_cwd(OS_PATH buffer, size_t size);
 extern int os_mkdir(char *path);
 
-extern int os_start_process(const char *process_name, unsigned int 
*p_process_id);
-extern int os_stop_process(unsigned int process_id);
-extern void os_sleep(unsigned long time);
-extern void os_create_thread(unsigned long long *p_thread_id, void 
*(*callback)(void *), void *callback_arg);
-extern unsigned long long os_get_thread_id();
-
 extern OS_MUTEX *os_mutex_init(const char *name);
 extern int os_mutex_lock(OS_MUTEX *p_mutex);
 extern int os_mutex_unlock(OS_MUTEX *p_mutex);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ipmctl-03.00.00.0407/src/os/win/win_system.c 
new/ipmctl-03.00.00.0423/src/os/win/win_system.c
--- old/ipmctl-03.00.00.0407/src/os/win/win_system.c    2021-11-03 
23:06:12.000000000 +0100
+++ new/ipmctl-03.00.00.0423/src/os/win/win_system.c    2022-01-05 
18:02:54.000000000 +0100
@@ -76,91 +76,6 @@
 }
 
 /*
- * Start a process and get its PID
- */
-int os_start_process(const char *process_name, unsigned int *p_process_id)
-{
-       int rc = -1;
-
-       OS_WPATH w_process_name;
-       utf8_to_wchar(w_process_name, (size_t)OS_PATH_LEN, process_name, 
(int)OS_PATH_LEN);
-
-       STARTUPINFOW start_up_info;
-       memset(&start_up_info, 0, sizeof (STARTUPINFOW));
-       start_up_info.cb = sizeof (STARTUPINFOW);
-
-       PROCESS_INFORMATION process_info;
-       memset(&process_info, 0, sizeof (PROCESS_INFORMATION));
-
-       int success = CreateProcessW(w_process_name, NULL, NULL, NULL, FALSE, 
0, NULL, NULL,
-                       &start_up_info, &process_info);
-       if (success)
-       {
-               *p_process_id = process_info.dwProcessId;
-               rc = 0;
-               // close handles
-               CloseHandle(process_info.hProcess);
-               CloseHandle(process_info.hThread);
-       }
-
-       return rc;
-}
-
-/*
- * Stop a process given the process handle
- */
-int os_stop_process(unsigned int process_id)
-{
-       int rc = -1;
-
-       // get the process handle from the process id
-       unsigned long access = PROCESS_TERMINATE;
-       HANDLE process_handle = OpenProcess(access, 0, process_id);
-       if (process_handle != NULL)
-       {
-               unsigned int exitCode = 0;
-               int success = TerminateProcess(process_handle, exitCode);
-               if (success)
-               {
-                       rc = 0;
-               }
-               CloseHandle(process_handle);
-       }
-
-       return rc;
-}
-
-/*
- * Blocks for the specified number of msecs.
- */
-void os_sleep(unsigned long time)
-{
-       Sleep(time);
-}
-
-/*
- * Create a thread on the current process
- */
-void os_create_thread(unsigned long long *p_thread_id, void *(*callback)(void 
*), void * callback_arg)
-{
-       CreateThread(
-                       NULL, // default security
-                       0,  // default stack size
-                       (LPTHREAD_START_ROUTINE)callback,
-                       (LPVOID)callback_arg,
-                       0, // Immediately run thread
-                       (LPDWORD)p_thread_id);
-}
-
-/*
- * Retrieve the id of the current thread
- */
-unsigned long long os_get_thread_id()
-{
-       return GetCurrentThreadId();
-}
-
-/*
  * Creates & Initializes a mutex.
  */
 OS_MUTEX * os_mutex_init(const char *name)

++++++ ipmctl-static-EDK2.patch.xz ++++++
++++ 58517 lines (skipped)
++++ between /work/SRC/openSUSE:Factory/ipmctl/ipmctl-static-EDK2.patch.xz
++++ and /work/SRC/openSUSE:Factory/.ipmctl.new.1892/ipmctl-static-EDK2.patch.xz

Reply via email to