mirror of https://github.com/acidanthera/audk.git
Fix bug where { NULL } did not terminate with a double NULL. Add support for passing in NULL for the string pack. Update the comments.
signed-off-by: andrewfish git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12955 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a0af6b2728
commit
b02127ec88
|
@ -137,12 +137,30 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Logs SMBIOS record.
|
Create SMBIOS record.
|
||||||
|
|
||||||
Note: This should be a genric library function.
|
Converts a fixed SMBIOS structure and an array of pointers to strings into
|
||||||
|
an SMBIOS record where the strings are cat'ed on the end of the fixed record
|
||||||
|
and terminated via a double NULL and add to SMBIOS table.
|
||||||
|
|
||||||
@param Template Fixed SMBIOS structure
|
SMBIOS_TABLE_TYPE32 gSmbiosType12 = {
|
||||||
@param StringPack Array of strings to convert to an SMBIOS string pack.
|
{ EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS, sizeof (SMBIOS_TABLE_TYPE12), 0 },
|
||||||
|
1 // StringCount
|
||||||
|
};
|
||||||
|
CHAR8 *gSmbiosType12Strings[] = {
|
||||||
|
"Not Found",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
...
|
||||||
|
LogSmbiosData (
|
||||||
|
(EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,
|
||||||
|
gSmbiosType12Strings
|
||||||
|
);
|
||||||
|
|
||||||
|
@param Template Fixed SMBIOS structure, required.
|
||||||
|
@param StringArray Array of strings to convert to an SMBIOS string pack.
|
||||||
|
NULL is OK.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -170,12 +188,21 @@ LogSmbiosData (
|
||||||
|
|
||||||
// Calculate the size of the fixed record and optional string pack
|
// Calculate the size of the fixed record and optional string pack
|
||||||
Size = Template->Length;
|
Size = Template->Length;
|
||||||
|
if (StringPack == NULL) {
|
||||||
|
// At least a double null is required
|
||||||
|
Size += 2;
|
||||||
|
} else {
|
||||||
for (Index = 0; StringPack[Index] != NULL; Index++) {
|
for (Index = 0; StringPack[Index] != NULL; Index++) {
|
||||||
StringSize = AsciiStrSize (StringPack[Index]);
|
StringSize = AsciiStrSize (StringPack[Index]);
|
||||||
Size += StringSize;
|
Size += StringSize;
|
||||||
}
|
}
|
||||||
|
if (StringPack[0] == NULL) {
|
||||||
|
// At least a double null is required
|
||||||
|
Size += 1;
|
||||||
|
}
|
||||||
// Don't forget the terminating double null
|
// Don't forget the terminating double null
|
||||||
Size += 1;
|
Size += 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Copy over Template
|
// Copy over Template
|
||||||
Record = (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size);
|
Record = (EFI_SMBIOS_TABLE_HEADER *)AllocateZeroPool (Size);
|
||||||
|
|
Loading…
Reference in New Issue