]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mach-keystone: Modify secure image size before copy
authorAndrew F. Davis <afd@ti.com>
Thu, 29 Jun 2017 13:38:25 +0000 (08:38 -0500)
committerTom Rini <trini@konsulko.com>
Mon, 10 Jul 2017 18:26:05 +0000 (14:26 -0400)
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@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
arch/arm/mach-keystone/mon.c

index 81009848d033afd0def2aa06305f6b73f1acb7bf..ebfb483a1bccd48d2988ed1218451d7bf89f1fc2 100644 (file)
@@ -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