Skip to contentSkip to conversation

arm: mach-omap2: Align image address before cache operations

PATCH In review Andrew F. Davis 3 participants 3 messages Jul 26, 2017 – Aug 1, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: mach-omap2: Align image address before cache operations

The image address passed to secure_boot_verify_image() may not be cacheline aligned, round the address down to the nearest cacheline.

---
 arch/arm/mach-omap2/sec-common.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/sec-common.c +4 -4
index 030b36f332..2d54a3165e 100644
@@ -112,8 +112,8 @@ int secure_boot_verify_image(void **image, size_t *size)
 
 	/* Perform cache writeback on input buffer */
 	flush_dcache_range(
-		(u32)*image,
-		(u32)*image + roundup(*size, ARCH_DMA_MINALIGN));
+		rounddown((u32)*image, ARCH_DMA_MINALIGN),
+		roundup((u32)*image + *size, ARCH_DMA_MINALIGN));
 
 	cert_addr = (uint32_t)*image;
 	sig_addr = find_sig_start((char *)*image, *size);
@@ -151,8 +151,8 @@ int secure_boot_verify_image(void **image, size_t *size)
 
 	/* Perform cache writeback on output buffer */
 	flush_dcache_range(
-		(u32)*image,
-		(u32)*image + roundup(*size, ARCH_DMA_MINALIGN));
+		rounddown((u32)*image, ARCH_DMA_MINALIGN),
+		roundup((u32)*image + *size, ARCH_DMA_MINALIGN));
 
 auth_exit:
 	if (result != 0) {
Signature · 1 line
2.13.0
#2 lore raw
In reply to Andrew F. Davis
Quoted 5 lines · Andrew F. Davis

The image address passed to secure_boot_verify_image() may not be cacheline aligned, round the address down to the nearest cacheline.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170731/993e61d4/attachment.sig>