Skip to contentSkip to conversation

Fix misaligned buffer in env_fat_save

PATCH In review Alex Kiernan 2 participants 2 messages Feb 7, 2018 – Feb 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix misaligned buffer in env_fat_save

When saving the environment on a platform which has DMA alignment larger than the natural alignment, env_fat_save triggers a debug message in file_fat_write:

Saving Environment to FAT... writing uboot.env
FAT: Misaligned buffer address (9df1c8e0)
OK

---

 env/fat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
env/fat.c +1 -1
index 35f7ab5..e6bd1f9 100644
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #ifdef CMD_SAVEENV
 static int env_fat_save(void)
 {
-	env_t	env_new;
+	env_t __aligned(ARCH_DMA_MINALIGN) env_new;
 	struct blk_desc *dev_desc = NULL;
 	disk_partition_t info;
 	int dev, part;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Alex Kiernan

When saving the environment on a platform which has DMA alignment larger than the natural alignment, env_fat_save triggers a debug message in file_fat_write:

Saving Environment to FAT... writing uboot.env
FAT: Misaligned buffer address (9df1c8e0)
OK

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: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180212/eada4f54/attachment.sig>