Skip to content

Commit

Permalink
OcSmbiosLib: Provide fallbacks for NULL memory SMBIOS strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldfish64 committed Oct 10, 2020
1 parent 4b8ab02 commit 6ca34fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OpenCore Changelog
#### v0.6.3
- Added support for xml comments in plist files
- Updated underlying EDK II package to edk2-stable202008
- Provide fallbacks for NULL memory SMBIOS strings

#### v0.6.2
- Updated builtin firmware versions for SMBIOS and the rest
Expand Down
12 changes: 8 additions & 4 deletions Library/OcSmbiosLib/SmbiosPatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,14 @@ PatchMemoryDevice (
Table->CurrentPtr.Standard.Type17->MemoryErrorInformationHandle = 0xFFFF;
}

SMBIOS_OVERRIDE_S (Table, Standard.Type17->Manufacturer, Original, NULL, &StringIndex, NULL);
SMBIOS_OVERRIDE_S (Table, Standard.Type17->SerialNumber, Original, NULL, &StringIndex, NULL);
SMBIOS_OVERRIDE_S (Table, Standard.Type17->AssetTag, Original, NULL, &StringIndex, NULL);
SMBIOS_OVERRIDE_S (Table, Standard.Type17->PartNumber, Original, NULL, &StringIndex, NULL);
//
// Some machines may have NULL values for these fields, which will cause SPMemoryReporter
// crashes or ??? to be displayed in About This Mac. Fallback to "Unknown" for such fields.
//
SMBIOS_OVERRIDE_S (Table, Standard.Type17->Manufacturer, Original, NULL, &StringIndex, "Unknown");
SMBIOS_OVERRIDE_S (Table, Standard.Type17->SerialNumber, Original, NULL, &StringIndex, "Unknown");
SMBIOS_OVERRIDE_S (Table, Standard.Type17->AssetTag, Original, NULL, &StringIndex, "Unknown");
SMBIOS_OVERRIDE_S (Table, Standard.Type17->PartNumber, Original, NULL, &StringIndex, "Unknown");

SMBIOS_OVERRIDE_V (Table, Standard.Type17->Attributes, Original, NULL, NULL);
SMBIOS_OVERRIDE_V (Table, Standard.Type17->ExtendedSize, Original, NULL, NULL);
Expand Down

0 comments on commit 6ca34fe

Please sign in to comment.