[U-Boot] [PATCH] arm: mach-keystone: Modify secure image size before copy

Andrew F. Davis afd at ti.com
Thu Jun 29 13:38:25 UTC 2017


The size of the secure image does not include the size of the
header, subtract this out before we move the image or we grab
extra data after the image.

Signed-off-by: Andrew F. Davis <afd at ti.com>
---
 arch/arm/mach-keystone/mon.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-keystone/mon.c b/arch/arm/mach-keystone/mon.c
index 81009848d0..ebfb483a1b 100644
--- a/arch/arm/mach-keystone/mon.c
+++ b/arch/arm/mach-keystone/mon.c
@@ -114,12 +114,12 @@ void board_fit_image_post_process(void **p_image, size_t *p_size)
 	}
 
 	/*
-	* Overwrite the image headers after authentication
-	* and decryption. Update size to reflect removal
-	* of header.
-	*/
-	memcpy(image, image + KS2_HS_SEC_HEADER_LEN, *p_size);
+	 * Overwrite the image headers after authentication
+	 * and decryption. Update size to reflect removal
+	 * of header.
+	 */
 	*p_size -= KS2_HS_SEC_HEADER_LEN;
+	memcpy(image, image + KS2_HS_SEC_HEADER_LEN, *p_size);
 
 	/*
 	 * Output notification of successful authentication to re-assure the
-- 
2.13.0



More information about the U-Boot mailing list