DynamicTablesPkg: IORT: Fix uninitialized memory usage

On enabling the /analyse option the VS2017 compiler
reports: warning C6001: Using uninitialized memory.

This warning is reported as some variables that were
being logged were uninitialised. To fix this, moved
the logging code after the variables being logged are
initialised.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
This commit is contained in:
Sami Mujawar 2019-08-05 16:30:38 +01:00 committed by mergify[bot]
parent 8b2ac43bd8
commit 4817953949
1 changed files with 48 additions and 48 deletions

View File

@ -1738,6 +1738,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" ItsGroupNodeCount = %d\n" \
" ItsGroupOffset = %d\n",
ItsGroupNodeCount,
ItsGroupOffset
));
}
// Named Component Nodes
@ -1760,6 +1768,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" NamedComponentNodeCount = %d\n" \
" NamedComponentOffset = %d\n",
NamedComponentNodeCount,
NamedComponentOffset
));
}
// Root Complex Nodes
@ -1782,6 +1798,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" RootComplexNodeCount = %d\n" \
" RootComplexOffset = %d\n",
RootComplexNodeCount,
RootComplexOffset
));
}
// SMMUv1/SMMUv2 Nodes
@ -1804,6 +1828,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" SmmuV1V2NodeCount = %d\n" \
" SmmuV1V2Offset = %d\n",
SmmuV1V2NodeCount,
SmmuV1V2Offset
));
}
// SMMUv3 Nodes
@ -1826,6 +1858,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" SmmuV3NodeCount = %d\n" \
" SmmuV3Offset = %d\n",
SmmuV3NodeCount,
SmmuV3Offset
));
}
// PMCG Nodes
@ -1848,6 +1888,14 @@ BuildIortTable (
goto error_handler;
}
TableSize += NodeSize;
DEBUG ((
DEBUG_INFO,
" PmcgNodeCount = %d\n" \
" PmcgOffset = %d\n",
PmcgNodeCount,
PmcgOffset
));
}
DEBUG ((
@ -1859,54 +1907,6 @@ BuildIortTable (
TableSize
));
DEBUG ((
DEBUG_INFO,
" ItsGroupNodeCount = %d\n" \
" ItsGroupOffset = %d\n",
ItsGroupNodeCount,
ItsGroupOffset
));
DEBUG ((
DEBUG_INFO,
" NamedComponentNodeCount = %d\n" \
" NamedComponentOffset = %d\n",
NamedComponentNodeCount,
NamedComponentOffset
));
DEBUG ((
DEBUG_INFO,
" RootComplexNodeCount = %d\n" \
" RootComplexOffset = %d\n",
RootComplexNodeCount,
RootComplexOffset
));
DEBUG ((
DEBUG_INFO,
" SmmuV1V2NodeCount = %d\n" \
" SmmuV1V2Offset = %d\n",
SmmuV1V2NodeCount,
SmmuV1V2Offset
));
DEBUG ((
DEBUG_INFO,
" SmmuV3NodeCount = %d\n" \
" SmmuV3Offset = %d\n",
SmmuV3NodeCount,
SmmuV3Offset
));
DEBUG ((
DEBUG_INFO,
" PmcgNodeCount = %d\n" \
" PmcgOffset = %d\n",
PmcgNodeCount,
PmcgOffset
));
if (TableSize > MAX_UINT32) {
Status = EFI_INVALID_PARAMETER;
DEBUG ((