diff options
author | Jacky Bai <ping.bai@nxp.com> | 2020-09-08 09:55:59 +0800 |
---|---|---|
committer | Jacky Bai <ping.bai@nxp.com> | 2020-09-08 16:06:53 +0800 |
commit | 1597f80de42f2669e579bed1eafed69ea1389660 (patch) | |
tree | 94099f070e8a2318e6137e267ef5932722227116 /plat/imx/imx8m/ddr/dram_retention.c | |
parent | 3f3abbf9dff9152bede95c02c945aa84c53f4bd3 (diff) |
MLK-24721 plat: imx8m: Fix the out of bound access to rank setting array
Fix the out of bound access to the rank setting array.
Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Diffstat (limited to 'plat/imx/imx8m/ddr/dram_retention.c')
-rw-r--r-- | plat/imx/imx8m/ddr/dram_retention.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/plat/imx/imx8m/ddr/dram_retention.c b/plat/imx/imx8m/ddr/dram_retention.c index 6a19f0e7..2dd79b61 100644 --- a/plat/imx/imx8m/ddr/dram_retention.c +++ b/plat/imx/imx8m/ddr/dram_retention.c @@ -24,6 +24,9 @@ static void rank_setting_update(void) uint32_t i, offset; uint32_t pstate_num = dram_info.num_fsp; + /* only support maximum 3 setpoints */ + pstate_num = (pstate_num > MAX_FSP_NUM) ? MAX_FSP_NUM : pstate_num; + for (i = 0; i < pstate_num; i++) { offset = i ? (i + 1) * 0x1000 : 0; if (dram_info.dram_type == DDRC_LPDDR4) { |