* [edk2-platforms][Patch 0/3] Fix Vlv2TbltDevicePkg build failures @ 2020-10-29 0:58 Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Michael D Kinney ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Michael D Kinney @ 2020-10-29 0:58 UTC (permalink / raw) To: devel; +Cc: Zailiang Sun, Yi Qian, Kilian Kegel * Add missing FMP Dependency Library mappings https://bugzilla.tianocore.org/show_bug.cgi?id=2983 * Add missing RngLib mapping * Use safe string and safe PcdLib functions Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Cc: Kilian Kegel <kilian_kegel@outlook.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Michael D Kinney (3): Vlv2TbltDevicePkg: Use safe string and PCD functions Vlv2TbltDevicePkg: Add missing FMP dependency libs Vlv2TbltDevicePkg: Add missing RngLib mapping .../FirmwareUpdate/FirmwareUpdate.c | 10 +- .../Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc | 5 +- .../FmpGreenSampleDevice.dsc | 5 +- .../Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc | 5 +- .../Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc | 5 +- .../PlatformInitPei/PlatformEarlyInit.c | 6 +- .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 1 + .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 1 + .../PlatformSetupDxe/PlatformSetupDxe.c | 40 +++--- .../PlatformSetupDxe/SetupInfoRecords.c | 39 +++--- .../MiscBaseBoardManufacturerFunction.c | 30 +++-- .../SmBiosMiscDxe/MiscBiosVendorFunction.c | 20 +-- .../MiscChassisManufacturerFunction.c | 28 +++-- .../SmBiosMiscDxe/MiscMemoryDeviceFunction.c | 30 +++-- ...MiscNumberOfInstallableLanguagesFunction.c | 6 +- .../SmBiosMiscDxe/MiscOemStringFunction.c | 10 +- .../SmBiosMiscDxe/MiscOemType0x90Function.c | 28 +++-- .../SmBiosMiscDxe/MiscOemType0x94Function.c | 115 +++++++++++------- .../SmBiosMiscDxe/MiscOnboardDeviceFunction.c | 10 +- ...cPortInternalConnectorDesignatorFunction.c | 12 +- .../MiscProcessorCacheFunction.c | 4 +- .../MiscProcessorInformationFunction.c | 28 +++-- .../MiscSystemLanguageStringFunction.c | 10 +- .../MiscSystemManufacturerFunction.c | 31 +++-- .../MiscSystemOptionStringFunction.c | 10 +- .../MiscSystemSlotDesignationFunction.c | 10 +- .../VlvPlatformInitDxe/IgdOpRegion.c | 4 +- 27 files changed, 315 insertions(+), 188 deletions(-) -- 2.28.0.windows.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions 2020-10-29 0:58 [edk2-platforms][Patch 0/3] Fix Vlv2TbltDevicePkg build failures Michael D Kinney @ 2020-10-29 0:58 ` Michael D Kinney 2020-10-29 2:52 ` Sun, Zailiang 2020-10-29 0:58 ` [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping Michael D Kinney 2 siblings, 1 reply; 7+ messages in thread From: Michael D Kinney @ 2020-10-29 0:58 UTC (permalink / raw) To: devel; +Cc: Zailiang Sun, Yi Qian Update all modules to use safe string functions from BaseLib and PcdLib to address build failures. Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- .../FirmwareUpdate/FirmwareUpdate.c | 10 +- .../PlatformInitPei/PlatformEarlyInit.c | 6 +- .../PlatformSetupDxe/PlatformSetupDxe.c | 40 +++--- .../PlatformSetupDxe/SetupInfoRecords.c | 39 +++--- .../MiscBaseBoardManufacturerFunction.c | 30 +++-- .../SmBiosMiscDxe/MiscBiosVendorFunction.c | 20 +-- .../MiscChassisManufacturerFunction.c | 28 +++-- .../SmBiosMiscDxe/MiscMemoryDeviceFunction.c | 30 +++-- ...MiscNumberOfInstallableLanguagesFunction.c | 6 +- .../SmBiosMiscDxe/MiscOemStringFunction.c | 10 +- .../SmBiosMiscDxe/MiscOemType0x90Function.c | 28 +++-- .../SmBiosMiscDxe/MiscOemType0x94Function.c | 115 +++++++++++------- .../SmBiosMiscDxe/MiscOnboardDeviceFunction.c | 10 +- ...cPortInternalConnectorDesignatorFunction.c | 12 +- .../MiscProcessorCacheFunction.c | 4 +- .../MiscProcessorInformationFunction.c | 28 +++-- .../MiscSystemLanguageStringFunction.c | 10 +- .../MiscSystemManufacturerFunction.c | 31 +++-- .../MiscSystemOptionStringFunction.c | 10 +- .../MiscSystemSlotDesignationFunction.c | 10 +- .../VlvPlatformInitDxe/IgdOpRegion.c | 4 +- 21 files changed, 297 insertions(+), 184 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c b/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c index a2fc54e20e..d4da8537e2 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + **/ @@ -239,7 +241,7 @@ ParseCommandLine ( PrintToken (STRING_TOKEN (STR_FWUPDATE_PATH_ERROR), HiiHandle, Argv[Index]); return EFI_INVALID_PARAMETER; } - StrCpy (mInputData.FileName, Argv[Index]); + StrCpyS (mInputData.FileName, sizeof (mInputData.FileName) / sizeof (CHAR16), Argv[Index]); mInputData.UpdateFromFile = TRUE; } } diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c index 59845a69c4..3d3fba4e4c 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -363,9 +363,9 @@ MeasuredBootInit ( ) { if (SystemConfiguration->MeasuredBootEnable) { - PcdSetBool (PcdMeasuredBootEnable, TRUE); + PcdSetBoolS (PcdMeasuredBootEnable, TRUE); } else { - PcdSetBool (PcdMeasuredBootEnable, FALSE); + PcdSetBoolS (PcdMeasuredBootEnable, FALSE); } return EFI_SUCCESS; diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c index f3850b2aff..a8a02e2687 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -236,8 +236,8 @@ SystemConfigCallback ( case EFI_BROWSER_ACTION_CHANGING: { if (KeyValue == 0x1235) { - StrCpy (StringBuffer1, L"Will you disable PTT ? "); - StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); + StrCpyS (StringBuffer1, 200, L"Will you disable PTT ? "); + StrCpyS (StringBuffer2, 200, L"Enter (YES) / Esc (NO)"); // // Popup a menu to notice user @@ -253,8 +253,8 @@ SystemConfigCallback ( } } else if (KeyValue == 0x1236) { - StrCpy (StringBuffer1, L"Will you revoke trust ? "); - StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); + StrCpyS (StringBuffer1, 200, L"Will you revoke trust ? "); + StrCpyS (StringBuffer2, 200, L"Enter (YES) / Esc (NO)"); // // Popup a menu to notice user @@ -271,9 +271,9 @@ SystemConfigCallback ( } } else if (KeyValue == 0x1239) { if (Value->u8 == 0x00) { - StrCpy (StringBuffer1, L"WARNING: SOC may be damaged due to high temperature"); - StrCpy (StringBuffer2, L"when DPTF is disabled and IGD turbo is enabled."); - StrCpy (StringBuffer3, L"Press Enter/ESC to continue..."); + StrCpyS (StringBuffer1, 200, L"WARNING: SOC may be damaged due to high temperature"); + StrCpyS (StringBuffer2, 200, L"when DPTF is disabled and IGD turbo is enabled."); + StrCpyS (StringBuffer3, 200, L"Press Enter/ESC to continue..."); // // Popup a menu to notice user @@ -286,9 +286,9 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"WARNING: All your data on the eMMC will be lost"); - StrCpy (StringBuffer2, L"Do you really want to enable secure erase on eMMC?"); - StrCpy (StringBuffer3, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"WARNING: All your data on the eMMC will be lost"); + StrCpyS (StringBuffer2, 200, L"Do you really want to enable secure erase on eMMC?"); + StrCpyS (StringBuffer3, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, StringBuffer3,NULL); @@ -364,8 +364,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to Commit Changes and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to Commit Changes and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -431,8 +431,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to Discard Changes and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to Discard Changes and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -451,8 +451,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to load setup defaults and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to load setup defaults and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -522,9 +522,9 @@ SystemConfigCallback ( ); } } else if ((KeyValue == 0x123A) || (KeyValue == 0x123B) || (KeyValue == 0x123C)) { - StrCpy (StringBuffer1, L"WARNING: Enable or disable USB Controllers will "); - StrCpy (StringBuffer2, L"make global reset to restart system."); - StrCpy (StringBuffer3, L"Press Enter/ESC to continue..."); + StrCpyS (StringBuffer1, 200, L"WARNING: Enable or disable USB Controllers will "); + StrCpyS (StringBuffer2, 200, L"make global reset to restart system."); + StrCpyS (StringBuffer3, 200, L"Press Enter/ESC to continue..."); // // Popup a menu to notice user // diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c index 1770d0de42..5a597d86da 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -138,7 +138,7 @@ GetOptionalStringByIndex ( return EFI_NOT_FOUND; } else { *String = AllocatePool (StrSize * sizeof (CHAR16)); - AsciiStrToUnicodeStr (OptionalStrStart, *String); + AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize); } return EFI_SUCCESS; @@ -418,9 +418,9 @@ PrepareSetupInformation ( Length = StrLen(ReleaseDate) + StrLen(ReleaseTime); BuildDateTime = AllocateZeroPool ((Length+2) * sizeof(CHAR16)); - StrCpy (BuildDateTime, ReleaseDate); - StrCat (BuildDateTime, L" "); - StrCat (BuildDateTime, ReleaseTime); + StrCpyS (BuildDateTime, Length + 2, ReleaseDate); + StrCatS (BuildDateTime, Length + 2, L" "); + StrCatS (BuildDateTime, Length + 2, ReleaseTime); TokenToUpdate = (STRING_REF)STR_BIOS_VERSION_VALUE; DEBUG ((EFI_D_ERROR, "update STR_BIOS_VERSION_VALUE\n")); @@ -991,7 +991,7 @@ UpdatePlatformInformation ( MrcVersion = 0x00000000; MrcVersion &= 0xffff; Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0); - StrCat (Buffer, L"."); + StrCatS (Buffer, sizeof (Buffer) / sizeof (CHAR16), L"."); EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0); EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MRC_VERSION_VALUE), Buffer, NULL); @@ -1081,15 +1081,16 @@ UpdatePlatformInformation ( VOID GetDeviceSpeedString ( CHAR16 *NewString, + UINTN NewStringSize, IN UINTN DeviceSpeed ) { if (DeviceSpeed == 0x01) { - StrCat (NewString, L"1.5Gb/s"); + StrCatS (NewString, NewStringSize, L"1.5Gb/s"); } else if (DeviceSpeed == 0x02) { - StrCat (NewString, L"3.0Gb/s"); + StrCatS (NewString, NewStringSize, L"3.0Gb/s"); } else if (DeviceSpeed == 0x03) { - StrCat (NewString, L"6.0Gb/s"); + StrCatS (NewString, NewStringSize, L"6.0Gb/s"); } else if (DeviceSpeed == 0x0) { } @@ -1206,6 +1207,7 @@ IdeDataFilter (void) UINT32 IdeDevice; EFI_ATA_IDENTIFY_DATA *IdentifyDriveInfo; CHAR16 *NewString; + UINTN NewStringSize; CHAR16 SizeString[20]; STRING_REF NameToUpdate; CHAR8 StringBuffer[0x100]; @@ -1216,6 +1218,7 @@ IdeDataFilter (void) // Assume no line strings is longer than 256 bytes. // NewString = AllocateZeroPool (0x100); + NewStringSize = 0x100 / sizeof (CHAR16); PciDevicePath = NULL; // @@ -1334,15 +1337,15 @@ IdeDataFilter (void) DriveSize = (UINT32) DivU64x32(MultU64x32(DivU64x32(DriveSize, 1000), 512), 1000); } - StrCat (NewString, L"("); + StrCatS (NewString, NewStringSize, L"("); EfiValueToString (SizeString, DriveSize/1000, PREFIX_BLANK, 0); - StrCat (NewString, SizeString); - StrCat (NewString, L"."); + StrCatS (NewString, NewStringSize, SizeString); + StrCatS (NewString, NewStringSize, L"."); EfiValueToString (SizeString, (DriveSize%1000)/100, PREFIX_BLANK, 0); - StrCat (NewString, SizeString); - StrCat (NewString, L"GB"); + StrCatS (NewString, NewStringSize, SizeString); + StrCatS (NewString, NewStringSize, L"GB"); } else { - StrCat (NewString, L"(ATAPI"); + StrCatS (NewString, NewStringSize, L"(ATAPI"); } // @@ -1352,11 +1355,11 @@ IdeDataFilter (void) DeviceSpeed = GetChipsetSataPortSpeed(PortNumber); if (DeviceSpeed) { - StrCat (NewString, L"-"); - GetDeviceSpeedString( NewString, DeviceSpeed); + StrCatS (NewString, NewStringSize, L"-"); + GetDeviceSpeedString( NewString, NewStringSize, DeviceSpeed); } - StrCat (NewString, L")"); + StrCatS (NewString, NewStringSize, L")"); HiiSetString(mHiiHandle, NameToUpdate, NewString, NULL); diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c index 8eddc5c2a6..5bd26f8028 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -40,6 +40,7 @@ extern EFI_PLATFORM_INFO_HOB *mPlatformInfo; MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN ProductStrLen; UINTN VerStrLen; @@ -167,8 +168,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); + OptionalStrSize = ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2); @@ -217,12 +219,22 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string // - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1); - UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); - UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS (Product, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ProductStrLen + 1); + OptionalStrSize -= (ProductStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS (AssertTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (AssertTagStrLen + 1); + OptionalStrSize -= (AssertTagStrLen + 1); + UnicodeStrToAsciiStrS (Chassis, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c index 0fbd5ac0bd..335752021f 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -148,6 +148,7 @@ Base2ToByteWith64KUnit ( MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN VendorStrLen; UINTN VerStrLen; UINTN DateStrLen; @@ -203,7 +204,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) Version = SmbiosMiscGetString (TokenToGet); ZeroMem (BIOSVersionTemp, sizeof (BIOSVersionTemp)); - StrCat (BIOSVersionTemp,Version); + StrCatS (BIOSVersionTemp, sizeof (BIOSVersionTemp) / sizeof (CHAR16), Version); VerStrLen = StrLen(BIOSVersionTemp); if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { return EFI_UNSUPPORTED; @@ -219,8 +220,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + OptionalStrSize = VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0); @@ -264,9 +266,13 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Char16String, OptionalStrStart); - UnicodeStrToAsciiStr(BIOSVersionTemp, OptionalStrStart + VendorStrLen + 1); - UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1); + UnicodeStrToAsciiStrS(Char16String, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VendorStrLen + 1); + OptionalStrSize -= (VendorStrLen + 1); + UnicodeStrToAsciiStrS(BIOSVersionTemp, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS(ReleaseDate, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c index c42ba3d0d1..75016eb9fa 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -40,6 +42,7 @@ extern EFI_PLATFORM_INFO_HOB *mPlatformInfo; MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN VerStrLen; UINTN AssertTagStrLen; @@ -99,8 +102,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); + OptionalStrSize = ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3); @@ -137,10 +141,16 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4); OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1); - UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + UnicodeStrToAsciiStrS(Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS(Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS(SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS(AssertTag, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c index 3e74ec31db..e64e4bd2a0 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -81,6 +81,7 @@ GetType16Hndl ( MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN MemDeviceStrLen; UINTN MemBankLocatorStrLen; UINTN MemManufacturerStrLen; @@ -246,8 +247,9 @@ MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); + OptionalStrSize = MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE17) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE17) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE17); @@ -287,12 +289,22 @@ MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) SmbiosRecord->MemoryType = MemoryType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(MemDevice, OptionalStrStart); - UnicodeStrToAsciiStr(MemBankLocator, OptionalStrStart + MemDeviceStrLen + 1); - UnicodeStrToAsciiStr(MemManufacturer, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1); - UnicodeStrToAsciiStr(MemSerialNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1); - UnicodeStrToAsciiStr(MemAssetTag, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1); - UnicodeStrToAsciiStr(MemPartNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1+ MemAssetTagStrLen+1 ); + UnicodeStrToAsciiStrS (MemDevice, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemDeviceStrLen + 1); + OptionalStrSize -= (MemDeviceStrLen + 1); + UnicodeStrToAsciiStrS (MemBankLocator, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemBankLocatorStrLen + 1); + OptionalStrSize -= (MemBankLocatorStrLen + 1); + UnicodeStrToAsciiStrS (MemManufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemManufacturerStrLen + 1); + OptionalStrSize -= (MemManufacturerStrLen + 1); + UnicodeStrToAsciiStrS (MemSerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemSerialNumberStrLen + 1); + OptionalStrSize -= (MemSerialNumberStrLen + 1); + UnicodeStrToAsciiStrS (MemAssetTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemAssetTagStrLen + 1); + OptionalStrSize -= (MemAssetTagStrLen + 1); + UnicodeStrToAsciiStrS (MemPartNumber, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c index 4a96a2c465..24bf6250e4 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -56,7 +56,7 @@ CurrentLanguageMatch ( return; } - CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLang, NULL); DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang); BestLanguage = GetBestLanguage ( Languages, @@ -234,7 +234,7 @@ MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages) SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat; SmbiosRecord->CurrentLanguages = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - AsciiStrCpy(OptionalStrStart, CurrentLang); + AsciiStrCpyS(OptionalStrStart, LangStrLen + 1 + 1, CurrentLang); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c index 8624481149..50d16a196b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -72,7 +74,7 @@ MISC_SMBIOS_TABLE_FUNCTION(OemString) SmbiosRecord->Hdr.Handle = 0; SmbiosRecord->StringCount = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(OemStr, OptionalStrStart); + UnicodeStrToAsciiStrS (OemStr, OptionalStrStart, OemStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c index d5a4243624..1aa632ccef 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved. - +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + @@ -286,6 +288,7 @@ AddSmbiosT0x90Callback ( CHAR16 *Stepping; STRING_REF TokenToGet; CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; EFI_SMBIOS_PROTOCOL *SmbiosProtocol; DEBUG ((EFI_D_INFO, "Executing SMBIOS T0x90 callback.\n")); @@ -340,8 +343,9 @@ AddSmbiosT0x90Callback ( return EFI_UNSUPPORTED; } - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); + OptionalStrSize = SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE90) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE90) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_FIRMWARE_VERSION_INFO; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE90); @@ -372,10 +376,16 @@ AddSmbiosT0x90Callback ( SmbiosRecord->CpuStepping = 4; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SECVer, OptionalStrStart); - UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + SECVerStrLen + 1); - UnicodeStrToAsciiStr(GOPVer, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1); - UnicodeStrToAsciiStr(Stepping, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1); + UnicodeStrToAsciiStrS (SECVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SECVerStrLen + 1); + OptionalStrSize -= (SECVerStrLen + 1); + UnicodeStrToAsciiStrS (uCodeVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (uCodeVerStrLen + 1); + OptionalStrSize -= (uCodeVerStrLen + 1); + UnicodeStrToAsciiStrS (GOPVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (GOPStrLen + 1); + OptionalStrSize -= (GOPStrLen + 1); + UnicodeStrToAsciiStrS (Stepping, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c index f1bb15ae6e..54915e9053 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 1999 - 2019, Intel Corporation. All rights reserved. +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -604,7 +604,7 @@ UpdatePlatformInformation ( MrcVersion = MmioRead32 (MmPciAddress (0, 0, 0, 0, 0xF0)); MrcVersion &= 0xffff; Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0); - StrCat (Buffer, L"."); + StrCatS (Buffer, sizeof (Buffer) / sizeof (CHAR16), L"."); EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0); EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_MRC_VERSION_VALUE), Buffer, NULL); @@ -1064,72 +1064,95 @@ AddSmbiosT0x94Callback ( OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(GOPVer, OptionalStrStart); - StrIdx += GOPStrLen + 1; + RecordLen -= sizeof (SMBIOS_TABLE_TYPE94); + UnicodeStrToAsciiStrS (GOPVer, OptionalStrStart, RecordLen); + StrIdx += GOPStrLen + 1; + RecordLen -= GOPStrLen + 1; - UnicodeStrToAsciiStr(SECVer, OptionalStrStart + StrIdx); - StrIdx += SECVerStrLen + 1; + UnicodeStrToAsciiStrS (SECVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SECVerStrLen + 1; + RecordLen -= SECVerStrLen + 1; - UnicodeStrToAsciiStr(MrcVer, OptionalStrStart + StrIdx); - StrIdx += MRCVersionStrLen + 1; + UnicodeStrToAsciiStrS (MrcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += MRCVersionStrLen + 1; + RecordLen -= MRCVersionStrLen + 1; - UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + StrIdx); - StrIdx += uCodeVerStrLen + 1; + UnicodeStrToAsciiStrS (uCodeVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += uCodeVerStrLen + 1; + RecordLen -= uCodeVerStrLen + 1; - UnicodeStrToAsciiStr(PunitVer, OptionalStrStart + StrIdx); - StrIdx += PUNITVersionStrLen + 1; + UnicodeStrToAsciiStrS (PunitVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PUNITVersionStrLen + 1; + RecordLen -= PUNITVersionStrLen + 1; - UnicodeStrToAsciiStr(PmcVer, OptionalStrStart + StrIdx); - StrIdx += PMCVersionStrLen + 1; + UnicodeStrToAsciiStrS (PmcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PMCVersionStrLen + 1; + RecordLen -= PMCVersionStrLen + 1; - UnicodeStrToAsciiStr(UlpmcVer, OptionalStrStart + StrIdx); - StrIdx += ULPMCVersionStrLen + 1; + UnicodeStrToAsciiStrS (UlpmcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += ULPMCVersionStrLen + 1; + RecordLen -= ULPMCVersionStrLen + 1; - UnicodeStrToAsciiStr(SocVer, OptionalStrStart + StrIdx); - StrIdx += SOCVersionStrLen +1; + UnicodeStrToAsciiStrS (SocVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SOCVersionStrLen +1; + RecordLen -= SOCVersionStrLen +1; - UnicodeStrToAsciiStr(BoardVer, OptionalStrStart + StrIdx); - StrIdx += BOARDVersionStrLen + 1; + UnicodeStrToAsciiStrS (BoardVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BOARDVersionStrLen + 1; + RecordLen -= BOARDVersionStrLen + 1; - UnicodeStrToAsciiStr(FabVer, OptionalStrStart + StrIdx); - StrIdx += FABVersionStrLen + 1; + UnicodeStrToAsciiStrS (FabVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += FABVersionStrLen + 1; + RecordLen -= FABVersionStrLen + 1; - UnicodeStrToAsciiStr(CpuFlavor, OptionalStrStart + StrIdx); - StrIdx += CPUFLAVORStrLen + 1; + UnicodeStrToAsciiStrS (CpuFlavor, OptionalStrStart + StrIdx, RecordLen); + StrIdx += CPUFLAVORStrLen + 1; + RecordLen -= CPUFLAVORStrLen + 1; - UnicodeStrToAsciiStr(BiosVer, OptionalStrStart + StrIdx); - StrIdx += BIOSVersionStrLen + 1; + UnicodeStrToAsciiStrS (BiosVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BIOSVersionStrLen + 1; + RecordLen -= BIOSVersionStrLen + 1; - UnicodeStrToAsciiStr(PmicVer, OptionalStrStart + StrIdx); - StrIdx += PMICVersionStrLen + 1; + UnicodeStrToAsciiStrS (PmicVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PMICVersionStrLen + 1; + RecordLen -= PMICVersionStrLen + 1; - UnicodeStrToAsciiStr(TouchVer, OptionalStrStart + StrIdx); - StrIdx += TOUCHVersionStrLen + 1; + UnicodeStrToAsciiStrS (TouchVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += TOUCHVersionStrLen + 1; + RecordLen -= TOUCHVersionStrLen + 1; - UnicodeStrToAsciiStr(SecureBootMode, OptionalStrStart + StrIdx); - StrIdx += SecureBootModeLen + 1; + UnicodeStrToAsciiStrS (SecureBootMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SecureBootModeLen + 1; + RecordLen -= SecureBootModeLen + 1; - UnicodeStrToAsciiStr(BootMode, OptionalStrStart + StrIdx); - StrIdx += BootModeLen + 1; + UnicodeStrToAsciiStrS (BootMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BootModeLen + 1; + RecordLen -= BootModeLen + 1; - UnicodeStrToAsciiStr(SpeedStepMode, OptionalStrStart + StrIdx); - StrIdx += SpeedStepModeLen + 1; + UnicodeStrToAsciiStrS (SpeedStepMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SpeedStepModeLen + 1; + RecordLen -= SpeedStepModeLen + 1; - UnicodeStrToAsciiStr(CpuTurbo, OptionalStrStart + StrIdx); - StrIdx += CpuTurboLen + 1; + UnicodeStrToAsciiStrS (CpuTurbo, OptionalStrStart + StrIdx, RecordLen); + StrIdx += CpuTurboLen + 1; + RecordLen -= CpuTurboLen + 1; - UnicodeStrToAsciiStr(MaxCState, OptionalStrStart + StrIdx); - StrIdx += MaxCStateLen + 1; + UnicodeStrToAsciiStrS (MaxCState, OptionalStrStart + StrIdx, RecordLen); + StrIdx += MaxCStateLen + 1; + RecordLen -= MaxCStateLen + 1; - UnicodeStrToAsciiStr(GfxTurbo, OptionalStrStart + StrIdx); - StrIdx += GfxTurboLen + 1; + UnicodeStrToAsciiStrS (GfxTurbo, OptionalStrStart + StrIdx, RecordLen); + StrIdx += GfxTurboLen + 1; + RecordLen -= GfxTurboLen + 1; - UnicodeStrToAsciiStr(IdleReserve, OptionalStrStart + StrIdx); - StrIdx += S0ixLen + 1; + UnicodeStrToAsciiStrS (IdleReserve, OptionalStrStart + StrIdx, RecordLen); + StrIdx += S0ixLen + 1; + RecordLen -= S0ixLen + 1; - UnicodeStrToAsciiStr(RC6, OptionalStrStart + StrIdx); - StrIdx += RC6Len + 1; + UnicodeStrToAsciiStrS (RC6, OptionalStrStart + StrIdx, RecordLen); + StrIdx += RC6Len + 1; + RecordLen -= RC6Len + 1; // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c index aef25065b8..1a02dbb349 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -118,7 +120,7 @@ MISC_SMBIOS_TABLE_FUNCTION ( SmbiosRecord->Device[0].DeviceType = StatusAndType; SmbiosRecord->Device[0].DescriptionString = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(DeviceDescription, OptionalStrStart); + UnicodeStrToAsciiStrS (DeviceDescription, OptionalStrStart, DescriptionStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c index 6bc088cd13..73975809db 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -134,8 +136,8 @@ MISC_SMBIOS_TABLE_FUNCTION ( SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(InternalRef, OptionalStrStart); - UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1); + UnicodeStrToAsciiStrS (InternalRef, OptionalStrStart, InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1); + UnicodeStrToAsciiStrS (ExternalRef, OptionalStrStart + InternalRefStrLen + 1, ExternalRefStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c index c64e87e20b..fadace2205 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -147,7 +147,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscProcessorCache) // SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SocketDesignation, OptionalStrStart); + UnicodeStrToAsciiStrS (SocketDesignation, OptionalStrStart, + 7 + 1 + 1); Smbios->Add( Smbios, diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c index 8a52d017c1..3360bdc541 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -199,6 +199,7 @@ MeasureTscFrequency ( MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; EFI_STRING SerialNumber; CHAR16 *Version=NULL; CHAR16 *Manufacturer=NULL; @@ -306,7 +307,8 @@ MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) // // Two zeros following the last string. // - SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE4) + AssetTagStrLen + 1 + SocketStrLen + 1+ ManufacturerStrLen +1 + VersionStrLen+ 1+ SerialNumberStrLen + 1 + PartNumberStrLen+ 1 + 1); + OptionalStrSize = AssetTagStrLen + 1 + SocketStrLen + 1+ ManufacturerStrLen +1 + VersionStrLen+ 1+ SerialNumberStrLen + 1 + PartNumberStrLen+ 1 + 1; + SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE4) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4); @@ -421,12 +423,22 @@ MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) SmbiosRecord->L3CacheHandle = L3CacheHandle; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Socket, OptionalStrStart); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart + SocketStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + SocketStrLen + 1 + ManufacturerStrLen+ 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + SocketStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1); - UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1); - UnicodeStrToAsciiStr(PartNumber, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1 + AssetTagStrLen + 1 ); + UnicodeStrToAsciiStrS (Socket, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SocketStrLen + 1); + OptionalStrSize -= (SocketStrLen + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManufacturerStrLen + 1); + OptionalStrSize -= (ManufacturerStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VersionStrLen + 1); + OptionalStrSize -= (VersionStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumberStrLen + 1); + OptionalStrSize -= (SerialNumberStrLen + 1); + UnicodeStrToAsciiStrS (AssetTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (AssetTagStrLen + 1); + OptionalStrSize -= (AssetTagStrLen + 1); + UnicodeStrToAsciiStrS (PartNumber, OptionalStrStart, OptionalStrSize); // // Now we have got the full Smbios record, call Smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c index 8abfa4074a..70f44f9290 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -75,7 +77,7 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) SmbiosRecord->Flags = 1; SmbiosRecord->CurrentLanguages = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Str, OptionalStrStart); + UnicodeStrToAsciiStrS (Str, OptionalStrStart, StrLeng + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c index b18dbd6ae2..efeebc92b8 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -47,6 +47,7 @@ AddSmbiosManuCallback ( { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN VerStrLen; UINTN PdNameStrLen; @@ -245,8 +246,9 @@ AddSmbiosManuCallback ( // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); + OptionalStrSize = ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1); @@ -290,13 +292,22 @@ AddSmbiosManuCallback ( SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1); - - UnicodeStrToAsciiStr(SkuNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); - UnicodeStrToAsciiStr(FamilyName, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen +1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS (ProductName, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (PdNameStrLen + 1); + OptionalStrSize -= (PdNameStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS (SkuNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SkuNumberStrLen + 1); + OptionalStrSize -= (SkuNumberStrLen + 1); + UnicodeStrToAsciiStrS (FamilyName, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c index ee27a75e3a..1609bca79b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -75,7 +77,7 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString) SmbiosRecord->StringCount = 1; OptionalStrStart = (CHAR8*) (SmbiosRecord + 1); - UnicodeStrToAsciiStr(OptionString, OptionalStrStart); + UnicodeStrToAsciiStrS (OptionString, OptionalStrStart, OptStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c index 7270ef826f..aeed9a79a9 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -111,7 +113,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation) // CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2); OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart); + UnicodeStrToAsciiStrS (SlotDesignation, OptionalStrStart, SlotDesignationStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. // diff --git a/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c b/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c index 3815c8fa9c..970a3271c5 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c @@ -1,7 +1,7 @@ /*++ -Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved +Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved SPDX-License-Identifier: BSD-2-Clause-Patent @@ -499,7 +499,7 @@ SetGOPVersionCallback ( ZeroMem (GopVersion, sizeof (GopVersion)); Status = GetGOPDriverVersion(GopVersion); if(!EFI_ERROR(Status)) { - StrCpy((CHAR16*)&(mIgdOpRegion.OpRegion->Header.GOPV[0]), GopVersion); + StrCpyS ((CHAR16*)&(mIgdOpRegion.OpRegion->Header.GOPV[0]), 16, GopVersion); return Status; } return EFI_UNSUPPORTED; -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions 2020-10-29 0:58 ` [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Michael D Kinney @ 2020-10-29 2:52 ` Sun, Zailiang 0 siblings, 0 replies; 7+ messages in thread From: Sun, Zailiang @ 2020-10-29 2:52 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Qian, Yi Reviewed-by: Zailiang Sun <zailiang.sun@intel.com> -----Original Message----- From: Michael D Kinney <michael.d.kinney@intel.com> Sent: Thursday, October 29, 2020 8:59 AM To: devel@edk2.groups.io Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com> Subject: [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Update all modules to use safe string functions from BaseLib and PcdLib to address build failures. Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- .../FirmwareUpdate/FirmwareUpdate.c | 10 +- .../PlatformInitPei/PlatformEarlyInit.c | 6 +- .../PlatformSetupDxe/PlatformSetupDxe.c | 40 +++--- .../PlatformSetupDxe/SetupInfoRecords.c | 39 +++--- .../MiscBaseBoardManufacturerFunction.c | 30 +++-- .../SmBiosMiscDxe/MiscBiosVendorFunction.c | 20 +-- .../MiscChassisManufacturerFunction.c | 28 +++-- .../SmBiosMiscDxe/MiscMemoryDeviceFunction.c | 30 +++-- ...MiscNumberOfInstallableLanguagesFunction.c | 6 +- .../SmBiosMiscDxe/MiscOemStringFunction.c | 10 +- .../SmBiosMiscDxe/MiscOemType0x90Function.c | 28 +++-- .../SmBiosMiscDxe/MiscOemType0x94Function.c | 115 +++++++++++------- .../SmBiosMiscDxe/MiscOnboardDeviceFunction.c | 10 +- ...cPortInternalConnectorDesignatorFunction.c | 12 +- .../MiscProcessorCacheFunction.c | 4 +- .../MiscProcessorInformationFunction.c | 28 +++-- .../MiscSystemLanguageStringFunction.c | 10 +- .../MiscSystemManufacturerFunction.c | 31 +++-- .../MiscSystemOptionStringFunction.c | 10 +- .../MiscSystemSlotDesignationFunction.c | 10 +- .../VlvPlatformInitDxe/IgdOpRegion.c | 4 +- 21 files changed, 297 insertions(+), 184 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c b/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c index a2fc54e20e..d4da8537e2 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + **/ @@ -239,7 +241,7 @@ ParseCommandLine ( PrintToken (STRING_TOKEN (STR_FWUPDATE_PATH_ERROR), HiiHandle, Argv[Index]); return EFI_INVALID_PARAMETER; } - StrCpy (mInputData.FileName, Argv[Index]); + StrCpyS (mInputData.FileName, sizeof (mInputData.FileName) / sizeof (CHAR16), Argv[Index]); mInputData.UpdateFromFile = TRUE; } } diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c index 59845a69c4..3d3fba4e4c 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -363,9 +363,9 @@ MeasuredBootInit ( ) { if (SystemConfiguration->MeasuredBootEnable) { - PcdSetBool (PcdMeasuredBootEnable, TRUE); + PcdSetBoolS (PcdMeasuredBootEnable, TRUE); } else { - PcdSetBool (PcdMeasuredBootEnable, FALSE); + PcdSetBoolS (PcdMeasuredBootEnable, FALSE); } return EFI_SUCCESS; diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c index f3850b2aff..a8a02e2687 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/PlatformSetupDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -236,8 +236,8 @@ SystemConfigCallback ( case EFI_BROWSER_ACTION_CHANGING: { if (KeyValue == 0x1235) { - StrCpy (StringBuffer1, L"Will you disable PTT ? "); - StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); + StrCpyS (StringBuffer1, 200, L"Will you disable PTT ? "); + StrCpyS (StringBuffer2, 200, L"Enter (YES) / Esc (NO)"); // // Popup a menu to notice user @@ -253,8 +253,8 @@ SystemConfigCallback ( } } else if (KeyValue == 0x1236) { - StrCpy (StringBuffer1, L"Will you revoke trust ? "); - StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)"); + StrCpyS (StringBuffer1, 200, L"Will you revoke trust ? "); + StrCpyS (StringBuffer2, 200, L"Enter (YES) / Esc (NO)"); // // Popup a menu to notice user @@ -271,9 +271,9 @@ SystemConfigCallback ( } } else if (KeyValue == 0x1239) { if (Value->u8 == 0x00) { - StrCpy (StringBuffer1, L"WARNING: SOC may be damaged due to high temperature"); - StrCpy (StringBuffer2, L"when DPTF is disabled and IGD turbo is enabled."); - StrCpy (StringBuffer3, L"Press Enter/ESC to continue..."); + StrCpyS (StringBuffer1, 200, L"WARNING: SOC may be damaged due to high temperature"); + StrCpyS (StringBuffer2, 200, L"when DPTF is disabled and IGD turbo is enabled."); + StrCpyS (StringBuffer3, 200, L"Press Enter/ESC to continue..."); // // Popup a menu to notice user @@ -286,9 +286,9 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"WARNING: All your data on the eMMC will be lost"); - StrCpy (StringBuffer2, L"Do you really want to enable secure erase on eMMC?"); - StrCpy (StringBuffer3, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"WARNING: All your data on the eMMC will be lost"); + StrCpyS (StringBuffer2, 200, L"Do you really want to enable secure erase on eMMC?"); + StrCpyS (StringBuffer3, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, StringBuffer3,NULL); @@ -364,8 +364,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to Commit Changes and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to Commit Changes and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -431,8 +431,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to Discard Changes and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to Discard Changes and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -451,8 +451,8 @@ SystemConfigCallback ( // // Popup a menu to notice user // - StrCpy (StringBuffer1, L"Do you want to load setup defaults and Exit?"); - StrCpy (StringBuffer2, L" Enter (YES) / Esc (NO) "); + StrCpyS (StringBuffer1, 200, L"Do you want to load setup defaults and Exit?"); + StrCpyS (StringBuffer2, 200, L" Enter (YES) / Esc (NO) "); do { CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL); @@ -522,9 +522,9 @@ SystemConfigCallback ( ); } } else if ((KeyValue == 0x123A) || (KeyValue == 0x123B) || (KeyValue == 0x123C)) { - StrCpy (StringBuffer1, L"WARNING: Enable or disable USB Controllers will "); - StrCpy (StringBuffer2, L"make global reset to restart system."); - StrCpy (StringBuffer3, L"Press Enter/ESC to continue..."); + StrCpyS (StringBuffer1, 200, L"WARNING: Enable or disable USB Controllers will "); + StrCpyS (StringBuffer2, 200, L"make global reset to restart system."); + StrCpyS (StringBuffer3, 200, L"Press Enter/ESC to continue..."); // // Popup a menu to notice user // diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c index 1770d0de42..5a597d86da 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -138,7 +138,7 @@ GetOptionalStringByIndex ( return EFI_NOT_FOUND; } else { *String = AllocatePool (StrSize * sizeof (CHAR16)); - AsciiStrToUnicodeStr (OptionalStrStart, *String); + AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize); } return EFI_SUCCESS; @@ -418,9 +418,9 @@ PrepareSetupInformation ( Length = StrLen(ReleaseDate) + StrLen(ReleaseTime); BuildDateTime = AllocateZeroPool ((Length+2) * sizeof(CHAR16)); - StrCpy (BuildDateTime, ReleaseDate); - StrCat (BuildDateTime, L" "); - StrCat (BuildDateTime, ReleaseTime); + StrCpyS (BuildDateTime, Length + 2, ReleaseDate); + StrCatS (BuildDateTime, Length + 2, L" "); + StrCatS (BuildDateTime, Length + 2, ReleaseTime); TokenToUpdate = (STRING_REF)STR_BIOS_VERSION_VALUE; DEBUG ((EFI_D_ERROR, "update STR_BIOS_VERSION_VALUE\n")); @@ -991,7 +991,7 @@ UpdatePlatformInformation ( MrcVersion = 0x00000000; MrcVersion &= 0xffff; Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0); - StrCat (Buffer, L"."); + StrCatS (Buffer, sizeof (Buffer) / sizeof (CHAR16), L"."); EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0); EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MRC_VERSION_VALUE), Buffer, NULL); @@ -1081,15 +1081,16 @@ UpdatePlatformInformation ( VOID GetDeviceSpeedString ( CHAR16 *NewString, + UINTN NewStringSize, IN UINTN DeviceSpeed ) { if (DeviceSpeed == 0x01) { - StrCat (NewString, L"1.5Gb/s"); + StrCatS (NewString, NewStringSize, L"1.5Gb/s"); } else if (DeviceSpeed == 0x02) { - StrCat (NewString, L"3.0Gb/s"); + StrCatS (NewString, NewStringSize, L"3.0Gb/s"); } else if (DeviceSpeed == 0x03) { - StrCat (NewString, L"6.0Gb/s"); + StrCatS (NewString, NewStringSize, L"6.0Gb/s"); } else if (DeviceSpeed == 0x0) { } @@ -1206,6 +1207,7 @@ IdeDataFilter (void) UINT32 IdeDevice; EFI_ATA_IDENTIFY_DATA *IdentifyDriveInfo; CHAR16 *NewString; + UINTN NewStringSize; CHAR16 SizeString[20]; STRING_REF NameToUpdate; CHAR8 StringBuffer[0x100]; @@ -1216,6 +1218,7 @@ IdeDataFilter (void) // Assume no line strings is longer than 256 bytes. // NewString = AllocateZeroPool (0x100); + NewStringSize = 0x100 / sizeof (CHAR16); PciDevicePath = NULL; // @@ -1334,15 +1337,15 @@ IdeDataFilter (void) DriveSize = (UINT32) DivU64x32(MultU64x32(DivU64x32(DriveSize, 1000), 512), 1000); } - StrCat (NewString, L"("); + StrCatS (NewString, NewStringSize, L"("); EfiValueToString (SizeString, DriveSize/1000, PREFIX_BLANK, 0); - StrCat (NewString, SizeString); - StrCat (NewString, L"."); + StrCatS (NewString, NewStringSize, SizeString); + StrCatS (NewString, NewStringSize, L"."); EfiValueToString (SizeString, (DriveSize%1000)/100, PREFIX_BLANK, 0); - StrCat (NewString, SizeString); - StrCat (NewString, L"GB"); + StrCatS (NewString, NewStringSize, SizeString); + StrCatS (NewString, NewStringSize, L"GB"); } else { - StrCat (NewString, L"(ATAPI"); + StrCatS (NewString, NewStringSize, L"(ATAPI"); } // @@ -1352,11 +1355,11 @@ IdeDataFilter (void) DeviceSpeed = GetChipsetSataPortSpeed(PortNumber); if (DeviceSpeed) { - StrCat (NewString, L"-"); - GetDeviceSpeedString( NewString, DeviceSpeed); + StrCatS (NewString, NewStringSize, L"-"); + GetDeviceSpeedString( NewString, NewStringSize, DeviceSpeed); } - StrCat (NewString, L")"); + StrCatS (NewString, NewStringSize, L")"); HiiSetString(mHiiHandle, NameToUpdate, NewString, NULL); diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c index 8eddc5c2a6..5bd26f8028 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -40,6 +40,7 @@ extern EFI_PLATFORM_INFO_HOB *mPlatformInfo; MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN ProductStrLen; UINTN VerStrLen; @@ -167,8 +168,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); + OptionalStrSize = ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2); @@ -217,12 +219,22 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string // - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1); - UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); - UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS (Product, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ProductStrLen + 1); + OptionalStrSize -= (ProductStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS (AssertTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (AssertTagStrLen + 1); + OptionalStrSize -= (AssertTagStrLen + 1); + UnicodeStrToAsciiStrS (Chassis, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c index 0fbd5ac0bd..335752021f 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBiosVendorFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -148,6 +148,7 @@ Base2ToByteWith64KUnit ( MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN VendorStrLen; UINTN VerStrLen; UINTN DateStrLen; @@ -203,7 +204,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) Version = SmbiosMiscGetString (TokenToGet); ZeroMem (BIOSVersionTemp, sizeof (BIOSVersionTemp)); - StrCat (BIOSVersionTemp,Version); + StrCatS (BIOSVersionTemp, sizeof (BIOSVersionTemp) / sizeof (CHAR16), Version); VerStrLen = StrLen(BIOSVersionTemp); if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) { return EFI_UNSUPPORTED; @@ -219,8 +220,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1); + OptionalStrSize = VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0); @@ -264,9 +266,13 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Char16String, OptionalStrStart); - UnicodeStrToAsciiStr(BIOSVersionTemp, OptionalStrStart + VendorStrLen + 1); - UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1); + UnicodeStrToAsciiStrS(Char16String, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VendorStrLen + 1); + OptionalStrSize -= (VendorStrLen + 1); + UnicodeStrToAsciiStrS(BIOSVersionTemp, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS(ReleaseDate, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c index c42ba3d0d1..75016eb9fa 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscChassisManufacturerFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -40,6 +42,7 @@ extern EFI_PLATFORM_INFO_HOB *mPlatformInfo; MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN VerStrLen; UINTN AssertTagStrLen; @@ -99,8 +102,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1); + OptionalStrSize = ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3); @@ -137,10 +141,16 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4); OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1); - UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + UnicodeStrToAsciiStrS(Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS(Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS(SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS(AssertTag, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c index 3e74ec31db..e64e4bd2a0 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscMemoryDeviceFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -81,6 +81,7 @@ GetType16Hndl ( MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN MemDeviceStrLen; UINTN MemBankLocatorStrLen; UINTN MemManufacturerStrLen; @@ -246,8 +247,9 @@ MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE17) + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1); + OptionalStrSize = MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1 + MemAssetTagStrLen+1 + MemPartNumberStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE17) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE17) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_DEVICE; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE17); @@ -287,12 +289,22 @@ MISC_SMBIOS_TABLE_FUNCTION( MiscMemoryDevice ) SmbiosRecord->MemoryType = MemoryType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(MemDevice, OptionalStrStart); - UnicodeStrToAsciiStr(MemBankLocator, OptionalStrStart + MemDeviceStrLen + 1); - UnicodeStrToAsciiStr(MemManufacturer, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1); - UnicodeStrToAsciiStr(MemSerialNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1); - UnicodeStrToAsciiStr(MemAssetTag, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1); - UnicodeStrToAsciiStr(MemPartNumber, OptionalStrStart + MemDeviceStrLen + 1 + MemBankLocatorStrLen + 1 + MemManufacturerStrLen + 1 + MemSerialNumberStrLen + 1+ MemAssetTagStrLen+1 ); + UnicodeStrToAsciiStrS (MemDevice, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemDeviceStrLen + 1); + OptionalStrSize -= (MemDeviceStrLen + 1); + UnicodeStrToAsciiStrS (MemBankLocator, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemBankLocatorStrLen + 1); + OptionalStrSize -= (MemBankLocatorStrLen + 1); + UnicodeStrToAsciiStrS (MemManufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemManufacturerStrLen + 1); + OptionalStrSize -= (MemManufacturerStrLen + 1); + UnicodeStrToAsciiStrS (MemSerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemSerialNumberStrLen + 1); + OptionalStrSize -= (MemSerialNumberStrLen + 1); + UnicodeStrToAsciiStrS (MemAssetTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (MemAssetTagStrLen + 1); + OptionalStrSize -= (MemAssetTagStrLen + 1); + UnicodeStrToAsciiStrS (MemPartNumber, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c index 4a96a2c465..24bf6250e4 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -56,7 +56,7 @@ CurrentLanguageMatch ( return; } - CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLang, NULL); DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang); BestLanguage = GetBestLanguage ( Languages, @@ -234,7 +234,7 @@ MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages) SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat; SmbiosRecord->CurrentLanguages = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - AsciiStrCpy(OptionalStrStart, CurrentLang); + AsciiStrCpyS(OptionalStrStart, LangStrLen + 1 + 1, CurrentLang); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c index 8624481149..50d16a196b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -72,7 +74,7 @@ MISC_SMBIOS_TABLE_FUNCTION(OemString) SmbiosRecord->Hdr.Handle = 0; SmbiosRecord->StringCount = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(OemStr, OptionalStrStart); + UnicodeStrToAsciiStrS (OemStr, OptionalStrStart, OemStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c index d5a4243624..1aa632ccef 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x90Function.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved. - +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + @@ -286,6 +288,7 @@ AddSmbiosT0x90Callback ( CHAR16 *Stepping; STRING_REF TokenToGet; CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; EFI_SMBIOS_PROTOCOL *SmbiosProtocol; DEBUG ((EFI_D_INFO, "Executing SMBIOS T0x90 callback.\n")); @@ -340,8 +343,9 @@ AddSmbiosT0x90Callback ( return EFI_UNSUPPORTED; } - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE90) + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1); + OptionalStrSize = SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1 + SteppingStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE90) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE90) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_FIRMWARE_VERSION_INFO; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE90); @@ -372,10 +376,16 @@ AddSmbiosT0x90Callback ( SmbiosRecord->CpuStepping = 4; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SECVer, OptionalStrStart); - UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + SECVerStrLen + 1); - UnicodeStrToAsciiStr(GOPVer, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1); - UnicodeStrToAsciiStr(Stepping, OptionalStrStart + SECVerStrLen + 1 + uCodeVerStrLen + 1 + GOPStrLen + 1); + UnicodeStrToAsciiStrS (SECVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SECVerStrLen + 1); + OptionalStrSize -= (SECVerStrLen + 1); + UnicodeStrToAsciiStrS (uCodeVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (uCodeVerStrLen + 1); + OptionalStrSize -= (uCodeVerStrLen + 1); + UnicodeStrToAsciiStrS (GOPVer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (GOPStrLen + 1); + OptionalStrSize -= (GOPStrLen + 1); + UnicodeStrToAsciiStrS (Stepping, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c index f1bb15ae6e..54915e9053 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOemType0x94Function.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 1999 - 2019, Intel Corporation. All rights reserved. +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -604,7 +604,7 @@ UpdatePlatformInformation ( MrcVersion = MmioRead32 (MmPciAddress (0, 0, 0, 0, 0xF0)); MrcVersion &= 0xffff; Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0); - StrCat (Buffer, L"."); + StrCatS (Buffer, sizeof (Buffer) / sizeof (CHAR16), L"."); EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0); EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0); HiiSetString(mHiiHandle,STRING_TOKEN(STR_MISC_MRC_VERSION_VALUE), Buffer, NULL); @@ -1064,72 +1064,95 @@ AddSmbiosT0x94Callback ( OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(GOPVer, OptionalStrStart); - StrIdx += GOPStrLen + 1; + RecordLen -= sizeof (SMBIOS_TABLE_TYPE94); + UnicodeStrToAsciiStrS (GOPVer, OptionalStrStart, RecordLen); + StrIdx += GOPStrLen + 1; + RecordLen -= GOPStrLen + 1; - UnicodeStrToAsciiStr(SECVer, OptionalStrStart + StrIdx); - StrIdx += SECVerStrLen + 1; + UnicodeStrToAsciiStrS (SECVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SECVerStrLen + 1; + RecordLen -= SECVerStrLen + 1; - UnicodeStrToAsciiStr(MrcVer, OptionalStrStart + StrIdx); - StrIdx += MRCVersionStrLen + 1; + UnicodeStrToAsciiStrS (MrcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += MRCVersionStrLen + 1; + RecordLen -= MRCVersionStrLen + 1; - UnicodeStrToAsciiStr(uCodeVer, OptionalStrStart + StrIdx); - StrIdx += uCodeVerStrLen + 1; + UnicodeStrToAsciiStrS (uCodeVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += uCodeVerStrLen + 1; + RecordLen -= uCodeVerStrLen + 1; - UnicodeStrToAsciiStr(PunitVer, OptionalStrStart + StrIdx); - StrIdx += PUNITVersionStrLen + 1; + UnicodeStrToAsciiStrS (PunitVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PUNITVersionStrLen + 1; + RecordLen -= PUNITVersionStrLen + 1; - UnicodeStrToAsciiStr(PmcVer, OptionalStrStart + StrIdx); - StrIdx += PMCVersionStrLen + 1; + UnicodeStrToAsciiStrS (PmcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PMCVersionStrLen + 1; + RecordLen -= PMCVersionStrLen + 1; - UnicodeStrToAsciiStr(UlpmcVer, OptionalStrStart + StrIdx); - StrIdx += ULPMCVersionStrLen + 1; + UnicodeStrToAsciiStrS (UlpmcVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += ULPMCVersionStrLen + 1; + RecordLen -= ULPMCVersionStrLen + 1; - UnicodeStrToAsciiStr(SocVer, OptionalStrStart + StrIdx); - StrIdx += SOCVersionStrLen +1; + UnicodeStrToAsciiStrS (SocVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SOCVersionStrLen +1; + RecordLen -= SOCVersionStrLen +1; - UnicodeStrToAsciiStr(BoardVer, OptionalStrStart + StrIdx); - StrIdx += BOARDVersionStrLen + 1; + UnicodeStrToAsciiStrS (BoardVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BOARDVersionStrLen + 1; + RecordLen -= BOARDVersionStrLen + 1; - UnicodeStrToAsciiStr(FabVer, OptionalStrStart + StrIdx); - StrIdx += FABVersionStrLen + 1; + UnicodeStrToAsciiStrS (FabVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += FABVersionStrLen + 1; + RecordLen -= FABVersionStrLen + 1; - UnicodeStrToAsciiStr(CpuFlavor, OptionalStrStart + StrIdx); - StrIdx += CPUFLAVORStrLen + 1; + UnicodeStrToAsciiStrS (CpuFlavor, OptionalStrStart + StrIdx, RecordLen); + StrIdx += CPUFLAVORStrLen + 1; + RecordLen -= CPUFLAVORStrLen + 1; - UnicodeStrToAsciiStr(BiosVer, OptionalStrStart + StrIdx); - StrIdx += BIOSVersionStrLen + 1; + UnicodeStrToAsciiStrS (BiosVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BIOSVersionStrLen + 1; + RecordLen -= BIOSVersionStrLen + 1; - UnicodeStrToAsciiStr(PmicVer, OptionalStrStart + StrIdx); - StrIdx += PMICVersionStrLen + 1; + UnicodeStrToAsciiStrS (PmicVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += PMICVersionStrLen + 1; + RecordLen -= PMICVersionStrLen + 1; - UnicodeStrToAsciiStr(TouchVer, OptionalStrStart + StrIdx); - StrIdx += TOUCHVersionStrLen + 1; + UnicodeStrToAsciiStrS (TouchVer, OptionalStrStart + StrIdx, RecordLen); + StrIdx += TOUCHVersionStrLen + 1; + RecordLen -= TOUCHVersionStrLen + 1; - UnicodeStrToAsciiStr(SecureBootMode, OptionalStrStart + StrIdx); - StrIdx += SecureBootModeLen + 1; + UnicodeStrToAsciiStrS (SecureBootMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SecureBootModeLen + 1; + RecordLen -= SecureBootModeLen + 1; - UnicodeStrToAsciiStr(BootMode, OptionalStrStart + StrIdx); - StrIdx += BootModeLen + 1; + UnicodeStrToAsciiStrS (BootMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += BootModeLen + 1; + RecordLen -= BootModeLen + 1; - UnicodeStrToAsciiStr(SpeedStepMode, OptionalStrStart + StrIdx); - StrIdx += SpeedStepModeLen + 1; + UnicodeStrToAsciiStrS (SpeedStepMode, OptionalStrStart + StrIdx, RecordLen); + StrIdx += SpeedStepModeLen + 1; + RecordLen -= SpeedStepModeLen + 1; - UnicodeStrToAsciiStr(CpuTurbo, OptionalStrStart + StrIdx); - StrIdx += CpuTurboLen + 1; + UnicodeStrToAsciiStrS (CpuTurbo, OptionalStrStart + StrIdx, RecordLen); + StrIdx += CpuTurboLen + 1; + RecordLen -= CpuTurboLen + 1; - UnicodeStrToAsciiStr(MaxCState, OptionalStrStart + StrIdx); - StrIdx += MaxCStateLen + 1; + UnicodeStrToAsciiStrS (MaxCState, OptionalStrStart + StrIdx, RecordLen); + StrIdx += MaxCStateLen + 1; + RecordLen -= MaxCStateLen + 1; - UnicodeStrToAsciiStr(GfxTurbo, OptionalStrStart + StrIdx); - StrIdx += GfxTurboLen + 1; + UnicodeStrToAsciiStrS (GfxTurbo, OptionalStrStart + StrIdx, RecordLen); + StrIdx += GfxTurboLen + 1; + RecordLen -= GfxTurboLen + 1; - UnicodeStrToAsciiStr(IdleReserve, OptionalStrStart + StrIdx); - StrIdx += S0ixLen + 1; + UnicodeStrToAsciiStrS (IdleReserve, OptionalStrStart + StrIdx, RecordLen); + StrIdx += S0ixLen + 1; + RecordLen -= S0ixLen + 1; - UnicodeStrToAsciiStr(RC6, OptionalStrStart + StrIdx); - StrIdx += RC6Len + 1; + UnicodeStrToAsciiStrS (RC6, OptionalStrStart + StrIdx, RecordLen); + StrIdx += RC6Len + 1; + RecordLen -= RC6Len + 1; // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c index aef25065b8..1a02dbb349 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscOnboardDeviceFunction.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 1999 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -118,7 +120,7 @@ MISC_SMBIOS_TABLE_FUNCTION ( SmbiosRecord->Device[0].DeviceType = StatusAndType; SmbiosRecord->Device[0].DescriptionString = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(DeviceDescription, OptionalStrStart); + UnicodeStrToAsciiStrS (DeviceDescription, OptionalStrStart, DescriptionStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c index 6bc088cd13..73975809db 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscPortInternalConnectorDesignatorFunction.c @@ -1,10 +1,12 @@ /** @file -Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2004 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -134,8 +136,8 @@ MISC_SMBIOS_TABLE_FUNCTION ( SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(InternalRef, OptionalStrStart); - UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1); + UnicodeStrToAsciiStrS (InternalRef, OptionalStrStart, InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1); + UnicodeStrToAsciiStrS (ExternalRef, OptionalStrStart + InternalRefStrLen + 1, ExternalRefStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c index c64e87e20b..fadace2205 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorCacheFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -147,7 +147,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscProcessorCache) // SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SocketDesignation, OptionalStrStart); + UnicodeStrToAsciiStrS (SocketDesignation, OptionalStrStart, + 7 + 1 + 1); Smbios->Add( Smbios, diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c index 8a52d017c1..3360bdc541 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscProcessorInformationFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -199,6 +199,7 @@ MeasureTscFrequency ( MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; EFI_STRING SerialNumber; CHAR16 *Version=NULL; CHAR16 *Manufacturer=NULL; @@ -306,7 +307,8 @@ MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) // // Two zeros following the last string. // - SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE4) + AssetTagStrLen + 1 + SocketStrLen + 1+ ManufacturerStrLen +1 + VersionStrLen+ 1+ SerialNumberStrLen + 1 + PartNumberStrLen+ 1 + 1); + OptionalStrSize = AssetTagStrLen + 1 + SocketStrLen + 1+ ManufacturerStrLen +1 + VersionStrLen+ 1+ SerialNumberStrLen + 1 + PartNumberStrLen+ 1 + 1; + SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE4) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4); @@ -421,12 +423,22 @@ MISC_SMBIOS_TABLE_FUNCTION (MiscProcessorInformation) SmbiosRecord->L3CacheHandle = L3CacheHandle; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Socket, OptionalStrStart); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart + SocketStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + SocketStrLen + 1 + ManufacturerStrLen+ 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + SocketStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1); - UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1); - UnicodeStrToAsciiStr(PartNumber, OptionalStrStart + SerialNumberStrLen + 1 + VersionStrLen + 1 + ManufacturerStrLen + 1 + SocketStrLen + 1 + AssetTagStrLen + 1 ); + UnicodeStrToAsciiStrS (Socket, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SocketStrLen + 1); + OptionalStrSize -= (SocketStrLen + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManufacturerStrLen + 1); + OptionalStrSize -= (ManufacturerStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VersionStrLen + 1); + OptionalStrSize -= (VersionStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumberStrLen + 1); + OptionalStrSize -= (SerialNumberStrLen + 1); + UnicodeStrToAsciiStrS (AssetTag, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (AssetTagStrLen + 1); + OptionalStrSize -= (AssetTagStrLen + 1); + UnicodeStrToAsciiStrS (PartNumber, OptionalStrStart, OptionalStrSize); // // Now we have got the full Smbios record, call Smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c index 8abfa4074a..70f44f9290 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemLanguageStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -75,7 +77,7 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) SmbiosRecord->Flags = 1; SmbiosRecord->CurrentLanguages = 1; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Str, OptionalStrStart); + UnicodeStrToAsciiStrS (Str, OptionalStrStart, StrLeng + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c index b18dbd6ae2..efeebc92b8 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent @@ -47,6 +47,7 @@ AddSmbiosManuCallback ( { CHAR8 *OptionalStrStart; + UINTN OptionalStrSize; UINTN ManuStrLen; UINTN VerStrLen; UINTN PdNameStrLen; @@ -245,8 +246,9 @@ AddSmbiosManuCallback ( // // Two zeros following the last string. // - SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1); + OptionalStrSize = ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen + 1 + FamilyNameStrLen + 1 + 1; + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + OptionalStrSize); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + OptionalStrSize); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION; SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1); @@ -290,13 +292,22 @@ AddSmbiosManuCallback ( SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType; OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); - UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1); - UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1); - UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1); - - UnicodeStrToAsciiStr(SkuNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); - UnicodeStrToAsciiStr(FamilyName, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + SkuNumberStrLen +1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (ManuStrLen + 1); + OptionalStrSize -= (ManuStrLen + 1); + UnicodeStrToAsciiStrS (ProductName, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (PdNameStrLen + 1); + OptionalStrSize -= (PdNameStrLen + 1); + UnicodeStrToAsciiStrS (Version, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (VerStrLen + 1); + OptionalStrSize -= (VerStrLen + 1); + UnicodeStrToAsciiStrS (SerialNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SerialNumStrLen + 1); + OptionalStrSize -= (SerialNumStrLen + 1); + UnicodeStrToAsciiStrS (SkuNumber, OptionalStrStart, OptionalStrSize); + OptionalStrStart += (SkuNumberStrLen + 1); + OptionalStrSize -= (SkuNumberStrLen + 1); + UnicodeStrToAsciiStrS (FamilyName, OptionalStrStart, OptionalStrSize); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c index ee27a75e3a..1609bca79b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemOptionStringFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -75,7 +77,7 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString) SmbiosRecord->StringCount = 1; OptionalStrStart = (CHAR8*) (SmbiosRecord + 1); - UnicodeStrToAsciiStr(OptionString, OptionalStrStart); + UnicodeStrToAsciiStrS (OptionString, OptionalStrStart, OptStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c index 7270ef826f..aeed9a79a9 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemSlotDesignationFunction.c @@ -1,10 +1,12 @@ /*++ -Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> - +Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR> + + SPDX-License-Identifier: BSD-2-Clause-Patent - + + Module Name: @@ -111,7 +113,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation) // CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2); OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); - UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart); + UnicodeStrToAsciiStrS (SlotDesignation, OptionalStrStart, SlotDesignationStrLen + 1 + 1); // // Now we have got the full smbios record, call smbios protocol to add this record. // diff --git a/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c b/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c index 3815c8fa9c..970a3271c5 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c @@ -1,7 +1,7 @@ /*++ -Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved +Copyright (c) 2011 - 2020, Intel Corporation. All rights reserved SPDX-License-Identifier: BSD-2-Clause-Patent @@ -499,7 +499,7 @@ SetGOPVersionCallback ( ZeroMem (GopVersion, sizeof (GopVersion)); Status = GetGOPDriverVersion(GopVersion); if(!EFI_ERROR(Status)) { - StrCpy((CHAR16*)&(mIgdOpRegion.OpRegion->Header.GOPV[0]), GopVersion); + StrCpyS ((CHAR16*)&(mIgdOpRegion.OpRegion->Header.GOPV[0]), 16, GopVersion); return Status; } return EFI_UNSUPPORTED; -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs 2020-10-29 0:58 [edk2-platforms][Patch 0/3] Fix Vlv2TbltDevicePkg build failures Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Michael D Kinney @ 2020-10-29 0:58 ` Michael D Kinney 2020-10-29 2:53 ` Sun, Zailiang 2020-10-29 0:58 ` [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping Michael D Kinney 2 siblings, 1 reply; 7+ messages in thread From: Michael D Kinney @ 2020-10-29 0:58 UTC (permalink / raw) To: devel; +Cc: Zailiang Sun, Yi Qian, Kilian Kegel https://bugzilla.tianocore.org/show_bug.cgi?id=2983 Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Cc: Kilian Kegel <kilian_kegel@outlook.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc index 3bd9f150b3..d572f726c4 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Blue Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc index 61bdd36a96..5008532e3d 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Green Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc index 304519b294..ed7e3ec2e7 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Minnow Max system firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -48,6 +48,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc index 59851f2b41..e8771511bc 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Red Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull/FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs 2020-10-29 0:58 ` [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs Michael D Kinney @ 2020-10-29 2:53 ` Sun, Zailiang 0 siblings, 0 replies; 7+ messages in thread From: Sun, Zailiang @ 2020-10-29 2:53 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Qian, Yi, Kilian Kegel Looks good to me. Reviewed-by: Zailiang Sun <zailiang.sun@intel.com> -----Original Message----- From: Michael D Kinney <michael.d.kinney@intel.com> Sent: Thursday, October 29, 2020 8:59 AM To: devel@edk2.groups.io Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>; Kilian Kegel <kilian_kegel@outlook.com> Subject: [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs https://bugzilla.tianocore.org/show_bug.cgi?id=2983 Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Cc: Kilian Kegel <kilian_kegel@outlook.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc | 5 ++++- Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc index 3bd9f150b3..d572f726c4 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Blue Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull + /FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc index 61bdd36a96..5008532e3d 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Green Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull + /FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc index 304519b294..ed7e3ec2e7 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Minnow Max system firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -48,6 +48,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull + /FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc b/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc index 59851f2b41..e8771511bc 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc @@ -1,7 +1,7 @@ #/** @file # FmpDxe driver for Red Sample device firmware update. # -# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2018 - 2020, Intel Corporation. All rights +reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -44,6 +44,9 @@ # FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf + FmpDependencyLib|FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.inf + FmpDependencyCheckLib|FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.inf + + FmpDependencyDeviceLib|FmpDevicePkg/Library/FmpDependencyDeviceLibNull + /FmpDependencyDeviceLibNull.inf # # Platform specific capsule policy library # -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping 2020-10-29 0:58 [edk2-platforms][Patch 0/3] Fix Vlv2TbltDevicePkg build failures Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs Michael D Kinney @ 2020-10-29 0:58 ` Michael D Kinney 2020-10-29 2:52 ` Sun, Zailiang 2 siblings, 1 reply; 7+ messages in thread From: Michael D Kinney @ 2020-10-29 0:58 UTC (permalink / raw) To: devel; +Cc: Zailiang Sun, Yi Qian Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 1 + Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 1 + 2 files changed, 2 insertions(+) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc index 69758e8f36..8bfea0107b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc @@ -234,6 +234,7 @@ [LibraryClasses.common] FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf !if $(NETWORK_TLS_ENABLE) == TRUE diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc index 86c73699a6..58ca9d9623 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc @@ -236,6 +236,7 @@ [LibraryClasses.common] FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf !if $(NETWORK_TLS_ENABLE) == TRUE -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping 2020-10-29 0:58 ` [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping Michael D Kinney @ 2020-10-29 2:52 ` Sun, Zailiang 0 siblings, 0 replies; 7+ messages in thread From: Sun, Zailiang @ 2020-10-29 2:52 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Qian, Yi Looks good to me. Reviewed-by: Zailiang Sun <zailiang.sun@intel.com> -----Original Message----- From: Michael D Kinney <michael.d.kinney@intel.com> Sent: Thursday, October 29, 2020 8:59 AM To: devel@edk2.groups.io Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com> Subject: [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping Cc: Zailiang Sun <zailiang.sun@intel.com> Cc: Yi Qian <yi.qian@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> --- Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 1 + Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 1 + 2 files changed, 2 insertions(+) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc index 69758e8f36..8bfea0107b 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc @@ -234,6 +234,7 @@ [LibraryClasses.common] FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf !if $(NETWORK_TLS_ENABLE) == TRUE diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc index 86c73699a6..58ca9d9623 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc @@ -236,6 +236,7 @@ [LibraryClasses.common] FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf !if $(NETWORK_TLS_ENABLE) == TRUE -- 2.28.0.windows.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-10-29 2:53 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-10-29 0:58 [edk2-platforms][Patch 0/3] Fix Vlv2TbltDevicePkg build failures Michael D Kinney 2020-10-29 0:58 ` [edk2-platforms][Patch 1/3] Vlv2TbltDevicePkg: Use safe string and PCD functions Michael D Kinney 2020-10-29 2:52 ` Sun, Zailiang 2020-10-29 0:58 ` [edk2-platforms][Patch 2/3] Vlv2TbltDevicePkg: Add missing FMP dependency libs Michael D Kinney 2020-10-29 2:53 ` Sun, Zailiang 2020-10-29 0:58 ` [edk2-platforms][Patch 3/3] Vlv2TbltDevicePkg: Add missing RngLib mapping Michael D Kinney 2020-10-29 2:52 ` Sun, Zailiang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox