diff --git a/DcpmPkg/cli/Common.c b/DcpmPkg/cli/Common.c index 71d5aba2..494430df 100644 --- a/DcpmPkg/cli/Common.c +++ b/DcpmPkg/cli/Common.c @@ -2397,6 +2397,7 @@ ReadCmdLinePrintOptions( } FreeStringArray(Toks, NumToks); + FREE_POOL_SAFE(OutputOptions); return ReturnCode; } diff --git a/DcpmPkg/cli/CreateGoalCommand.c b/DcpmPkg/cli/CreateGoalCommand.c index 4375b4c9..5cbff240 100644 --- a/DcpmPkg/cli/CreateGoalCommand.c +++ b/DcpmPkg/cli/CreateGoalCommand.c @@ -574,6 +574,7 @@ CreateGoal( FREE_POOL_SAFE(pDimms); FREE_POOL_SAFE(pShowGoalOutputArgs); FREE_POOL_SAFE(pUnitsStr); + FREE_POOL_SAFE(pCommandStr); NVDIMM_EXIT_I64(ReturnCode); return ReturnCode; } diff --git a/DcpmPkg/cli/LoadGoalCommand.c b/DcpmPkg/cli/LoadGoalCommand.c index bf053a9e..399d4b36 100644 --- a/DcpmPkg/cli/LoadGoalCommand.c +++ b/DcpmPkg/cli/LoadGoalCommand.c @@ -278,6 +278,7 @@ LoadGoal( FREE_POOL_SAFE(pSocketIds); FREE_POOL_SAFE(pDimmIds); FREE_POOL_SAFE(pDimms); + FREE_POOL_SAFE(pCommandStr); FREE_POOL_SAFE(pLoadUserPath); FREE_POOL_SAFE(pUnitsStr); NVDIMM_EXIT_I64(ReturnCode); diff --git a/DcpmPkg/common/DataSet.c b/DcpmPkg/common/DataSet.c index 1b6ef864..97c7b69a 100644 --- a/DcpmPkg/common/DataSet.c +++ b/DcpmPkg/common/DataSet.c @@ -226,6 +226,7 @@ GetDataSet(DATA_SET_CONTEXT *Root, CHAR16 *NamePath, ...) { //split path, result toks are data set names if (NULL == (DataSetToks = StrSplit(FormattedNamePath, L'/', &NumDataSetToks))) { + FreePool(FormattedNamePath); return NULL; } FreePool(FormattedNamePath); diff --git a/DcpmPkg/common/FwUtility.h b/DcpmPkg/common/FwUtility.h index e19d2267..60afec16 100644 --- a/DcpmPkg/common/FwUtility.h +++ b/DcpmPkg/common/FwUtility.h @@ -41,6 +41,7 @@ #define OUT_MB_SIZE (1 << 20) //!< Size of the OS mailbox large output payload #define IN_PAYLOAD_SIZE (128) //!< Total size of the input payload registers #define OUT_PAYLOAD_SIZE (128) //!< Total size of the output payload registers +#define IN_PAYLOAD_SIZE_EXT_PAD (12) //!< Additional bytes to deal with DSM calls #define MB_COMPLETE 0x1 #define STATUS_MASK 0xFF @@ -53,8 +54,8 @@ typedef struct { UINT32 OutputPayloadSize; UINT32 LargeOutputPayloadSize; union{ - UINT8 Data[IN_PAYLOAD_SIZE]; - struct { + UINT8 Data[IN_PAYLOAD_SIZE + IN_PAYLOAD_SIZE_EXT_PAD]; + struct { UINT8 Opcode; UINT8 SubOpcode; UINT8 TransportInterface; diff --git a/DcpmPkg/driver/Core/Dimm.c b/DcpmPkg/driver/Core/Dimm.c index 1a093cfa..d6a0a163 100644 --- a/DcpmPkg/driver/Core/Dimm.c +++ b/DcpmPkg/driver/Core/Dimm.c @@ -3311,7 +3311,7 @@ FwCmdGetErrorLog ( pFwCmd->InputPayloadSize = sizeof(*pInputPayload); pFwCmd->OutputPayloadSize = OutputPayloadSize; pFwCmd->LargeOutputPayloadSize = LargeOutputPayloadSize; - CopyMem_S(&pFwCmd->InputPayload.Data, sizeof(pFwCmd->InputPayload.Data), pInputPayload, sizeof(pFwCmd->InputPayload.Data)); + CopyMem_S(&pFwCmd->InputPayload.Data, sizeof(pFwCmd->InputPayload.Data), pInputPayload, pFwCmd->InputPayloadSize); ReturnCode = PassThru(pDimm, pFwCmd, PT_LONG_TIMEOUT_INTERVAL); if (EFI_ERROR(ReturnCode)) { @@ -6880,7 +6880,6 @@ PopulateUninitializedDimmList( EFI_STATUS TempReturnCode = EFI_SUCCESS; PT_ID_DIMM_PAYLOAD *pPayload = NULL; - // Only populate dimms found from the NFIT table (they are already placed in // the UninitializedDimms list) LIST_FOR_EACH(pNode, &gNvmDimmData->PMEMDev.UninitializedDimms) { @@ -6917,7 +6916,10 @@ PopulateUninitializedDimmList( pDimm->ControllerRid = pPayload->Rid; } } + + FREE_POOL_SAFE(pPayload); } + return ReturnCode; } diff --git a/src/os/os_types.h b/src/os/os_types.h index f3e6f0a3..b5755164 100644 --- a/src/os/os_types.h +++ b/src/os/os_types.h @@ -127,6 +127,7 @@ enum dsm_vendor_error { #define IN_MB_SIZE (1 << 20) //!< Size of the OS mailbox large input payload #define OUT_MB_SIZE (1 << 20) //!< Size of the OS mailbox large output payload #define IN_PAYLOAD_SIZE (128) //!< Total size of the input payload registers +#define IN_PAYLOAD_SIZE_EXT_PAD (12) //!< Additional bytes to deal with DSM calls #define OUT_PAYLOAD_SIZE (128) //!< Total size of the output payload registers #define MB_COMPLETE 0x1 @@ -140,7 +141,7 @@ struct fw_cmd { unsigned int OutputPayloadSize; unsigned int LargeOutputPayloadSize; union { - unsigned char Data[IN_PAYLOAD_SIZE]; + unsigned char Data[IN_PAYLOAD_SIZE + IN_PAYLOAD_SIZE_EXT_PAD]; struct { unsigned char Opcode; unsigned char SubOpcode;