summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SmbiosDxe
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-11 11:58:27 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-12-11 11:58:27 +0000
commitf8ee20c982bab5764f61f987a483a8e0aac47e3a (patch)
tree850a3009d6658ca71bc1cfb36952aee22b9da36e /MdeModulePkg/Universal/SmbiosDxe
parented79462beecf7e6fe0a5f1a62cc9f7099b977779 (diff)
downloadedk2-platforms-f8ee20c982bab5764f61f987a483a8e0aac47e3a.tar.xz
Smbios driver wrong compute the offset when updating string for given handle.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9556 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SmbiosDxe')
-rw-r--r--MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
index 1cf7802450..a3a85d59db 100644
--- a/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
+++ b/MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c
@@ -141,7 +141,6 @@ GetSmbiosStructureSize (
//
while (*CharInStr != 0 || *(CharInStr+1) != 0) {
if (*CharInStr == 0) {
- *NumberOfStrings += 1;
*Size += 1;
CharInStr++;
}
@@ -160,12 +159,9 @@ GetSmbiosStructureSize (
//
CharInStr += StrLen;
*Size += StrLen;
-
- }
-
- if (*NumberOfStrings > 0) {
*NumberOfStrings += 1;
}
+
//
// count ending two zeros.
//
@@ -511,6 +507,11 @@ SmbiosUpdateString (
}
}
+ if (*StrStart == 0) {
+ StrStart ++;
+ TargetStrOffset ++;
+ }
+
//
// Now we get the string target
//
@@ -548,9 +549,11 @@ SmbiosUpdateString (
//
// Copy smbios structure and optional strings.
//
- CopyMem (Raw, SmbiosEntry->RecordHeader + 1, sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset);
- CopyMem ((VOID*)((UINTN)Raw + sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset), String, InputStrLen + 1);
- AsciiStrCpy((CHAR8*)((UINTN)Raw + sizeof(EFI_SMBIOS_TABLE_HEADER) + TargetStrOffset + InputStrLen + 1), (CHAR8*)Record + Record->Length + TargetStrOffset + TargetStrLen + 1);
+ CopyMem (Raw, SmbiosEntry->RecordHeader + 1, Record->Length + TargetStrOffset);
+ CopyMem ((VOID*)((UINTN)Raw + Record->Length + TargetStrOffset), String, InputStrLen + 1);
+ CopyMem ((CHAR8*)((UINTN)Raw + Record->Length + TargetStrOffset + InputStrLen + 1),
+ (CHAR8*)Record + Record->Length + TargetStrOffset + TargetStrLen + 1,
+ SmbiosEntry->RecordHeader->RecordSize - sizeof (EFI_SMBIOS_RECORD_HEADER) - Record->Length - TargetStrOffset - TargetStrLen - 1);
//
// Insert new record