]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
rockchip/rk3399: Fix memory corruptions or illegal memory access
authorCaesar Wang <wxt@rock-chips.com>
Tue, 30 Jan 2018 01:11:24 +0000 (09:11 +0800)
committerCaesar Wang <wxt@rock-chips.com>
Tue, 30 Jan 2018 06:31:37 +0000 (14:31 +0800)
Coverity scan done for the coreboot project found the issue:
Coverity (*** CID 1385418: Memory - illegal accesses (OVERRUN))
Coverity (*** CID 1385419: Memory - corruptions  (OVERRUN))

Fix the Converity error issue with store_cru[] loop needs to be one
element bigger.

Fixes: ARM-software/tf-issues#544
Change-Id: I420f0a660b24baaa5fc5e78fca242cf750c9bbc7
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
plat/rockchip/rk3399/drivers/pmu/pmu.c

index c666c3c200d4f47b8455843ab6107b61367efaf9..5c586aaaf93d2d833f77ba94b42440b84ed63f07 100644 (file)
@@ -32,7 +32,7 @@ DEFINE_BAKERY_LOCK(rockchip_pd_lock);
 
 static uint32_t cpu_warm_boot_addr;
 static char store_sram[SRAM_BIN_LIMIT + SRAM_TEXT_LIMIT + SRAM_DATA_LIMIT];
-static uint32_t store_cru[CRU_SDIO0_CON1 / 4];
+static uint32_t store_cru[CRU_SDIO0_CON1 / 4 + 1];
 static uint32_t store_usbphy0[7];
 static uint32_t store_usbphy1[7];
 static uint32_t store_grf_io_vsel;