audk/IntelFsp2Pkg/Library
Ranbir Singh 48c53994e6 IntelFsp2Pkg/Library/BaseFspCommonLib: Fix OVERRUN Coverity issue
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4200

FspData->PerfIdx is getting increased for every call unconditionally
in the function SetFspMeasurePoint and hence memory access can happen
for out of bound FspData->PerfData[] array entries also.

Example -
   FspData->PerfData is an array of 32 UINT64 entries. Assume a call
   is made to SetFspMeasurePoint function when the FspData->PerfIdx
   last value is 31. It gets incremented to 32 at line 400.
   Any subsequent call to SetFspMeasurePoint functions leads to
   FspData->PerfData[32] getting accessed which is out of the PerfData
   array as well as the FSP_GLOBAL_DATA structure boundary.

Hence keep array access and index increment inside if block only and
return invalid performance timestamp when PerfIdx is invalid.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Ranbir Singh <rsingh@ventanamicro.com>
Acked-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2023-05-30 05:13:36 +00:00
..
BaseCacheAsRamLibNull
BaseCacheLib
BaseDebugDeviceLibNull
BaseFspCommonLib IntelFsp2Pkg/Library/BaseFspCommonLib: Fix OVERRUN Coverity issue 2023-05-30 05:13:36 +00:00
BaseFspDebugLibSerialPort IntelFsp2Pkg: Fix code formatting errors 2022-10-04 16:53:59 +00:00
BaseFspMultiPhaseLib IntelFsp2Pkg/BaseFspMultiPhaseLib: Replace duplicate GUID 2022-10-04 16:53:59 +00:00
BaseFspPlatformLib IntelFsp2Pkg: Fix GCC Compiler warning. 2023-03-10 02:04:51 +00:00
BaseFspSwitchStackLib IntelFsp2Pkg: Fix code formatting errors 2022-10-04 16:53:59 +00:00
SecFspSecPlatformLibNull