\r
\r
/**\r
- Create the mappging database according to variable.\r
+ Create the mapping database according to variable.\r
\r
Read the environment variable(s) that contain the override mappings from Controller Device Path to\r
a set of Driver Device Paths, and create the mapping database in memory with those variable info.\r
VariableIndex += ((sizeof(UINT32) - ((UINTN) (VariableIndex))) & (sizeof(UINT32) - 1));\r
\r
//\r
- // Get all DriverDevicePath[]\r
+ // Get all DriverImageDevicePath[]\r
//\r
for (Index = 0; Index < DriverNumber; Index++) {\r
//\r
// NotEnd indicates whether current variable is the end variable.\r
//\r
if (NotEnd != 0) {\r
- UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum);\r
+ UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum++);\r
VariableBuffer = GetVariableAndSize (OverrideVariableName, &gEfiOverrideVariableGuid, &BufferSize);\r
ASSERT ((UINTN) VariableBuffer % sizeof(UINTN) == 0);\r
- VariableNum++;\r
if (VariableBuffer == NULL) {\r
FreeMappingDatabase (MappingDataBase);\r
return EFI_VOLUME_CORRUPTED;\r
// ItemIndex now points to the next PLATFORM_OVERRIDE_ITEM which is not covered by VariableNeededSize\r
//\r
VariableBuffer = AllocateZeroPool (VariableNeededSize);\r
+ ASSERT (VariableBuffer != NULL);\r
ASSERT ((UINTN) VariableBuffer % sizeof(UINTN) == 0);\r
\r
//\r
\r
if (!Found) {\r
//\r
- // if not find the wantted order location, add it as last item of the controller mapping item\r
+ // if not find the wanted order location, add it as last item of the controller mapping item\r
//\r
InsertTailList (&OverrideItem->DriverInfoList, &DriverImageInfo->Link);\r
OverrideItem->DriverInfoNum ++;\r
// After this call DevicePath points to the next Instance\r
//\r
Instance = GetNextDevicePathInstance (&DevicePath, &Size);\r
+ ASSERT (Instance != NULL);\r
+\r
Next = Instance;\r
while (!IsDevicePathEndType (Next)) {\r
Next = NextDevicePathNode (Next);\r