All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix data abort caused by mis-aligning fit data in
@ 2020-07-24  5:19 Reuben Dowle
  2020-08-24 14:26 ` Tom Rini
  0 siblings, 1 reply; 6+ messages in thread
From: Reuben Dowle @ 2020-07-24  5:19 UTC (permalink / raw)
  To: u-boot

Attempting to place device tree immediately after an image in memory can lead
to mis-aligned data accesses if that image size is not divisible by the
alignment requirements of the architecture.

Data aborts caused by this were observed on a custom Marvel A388 based system,
where the image was a uboot FIT file. The total size varies depending on the
uboot device tree size, which does not always lead to correct alignment.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
---
 common/spl/spl_fit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 365104f..d221075 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -349,9 +349,9 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 
 	/*
 	 * Use the address following the image as target address for the
-	 * device tree.
+	 * device tree. Ensure that address is appropriately aligned.
 	 */
-	image_info.load_addr = spl_image->load_addr + spl_image->size;
+	image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, ARCH_DMA_MINALIGN);
 
 	/* Figure out which device tree the board wants to use */
 	node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-24 21:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24  5:19 [PATCH] Fix data abort caused by mis-aligning fit data in Reuben Dowle
2020-08-24 14:26 ` Tom Rini
2020-08-24 20:05   ` Reuben Dowle
2020-08-24 20:39     ` Tom Rini
2020-08-24 21:18       ` Reuben Dowle
2020-08-24 21:22         ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.