ddr3libv2: fix memory overrun in ddr3TipIpTraining
- IF read requires and array (with entry per interface).
- in this function, one of the read used a single variable
which caused memory overrun
- this fixed Caelum DB failure when running elf file (from
Lauterbach) without debug info (-g) and is high optimization
level (Os). with debug info and no optimization (O0) there
was no error since the memory layout was different
Change-Id: I1f870a0c097f85f3a4a4b6961d3e878634df0d7b
Signed-off-by: hayim <hayim@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/24248
Reviewed-by: Moti Buskila <motib@marvell.com>
Tested-by: Star_Automation <star@marvell.com>
(cherry picked from commit 06db58c9137902e0e7459fc61444a151a999b03a)
Reviewed-on: http://vgitil04.il.marvell.com:8080/24312
diff --git a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3TrainingIpEngine.c b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3TrainingIpEngine.c
index b51d5c0..85d0540 100755
--- a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3TrainingIpEngine.c
+++ b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3TrainingIpEngine.c
@@ -558,8 +558,8 @@
/*need to check results for this Dunit */
for(pollCnt=0;pollCnt < maxPollingForDone;pollCnt++)
{
- CHECK_STATUS(mvHwsDdr3TipIFRead(devNum, ACCESS_TYPE_UNICAST, indexCnt, ODPG_TRAINING_STATUS_REG, ®Data, MASK_ALL_BITS));
- if ((regData & 0x2) != 0)
+ CHECK_STATUS(mvHwsDdr3TipIFRead(devNum, ACCESS_TYPE_UNICAST, indexCnt, ODPG_TRAINING_STATUS_REG, readData, MASK_ALL_BITS));
+ if ((readData[indexCnt] & 0x2) != 0)
{
/*done */
trainStatus[indexCnt] = MV_HWS_TrainingIpStatus_SUCCESS;