From f85ff1d2f8da6559a524d9e7fdb99ce7534e5ad2 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Tue, 30 Jul 2019 20:01:51 -0500 Subject: [PATCH] lfs: correct alignment restriction on lookahead buffer The buffer need only be 32-bit aligned. Signed-off-by: Peter A. Bigot --- lfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lfs.c b/lfs.c index e7c4dae..cabb8c9 100644 --- a/lfs.c +++ b/lfs.c @@ -3412,10 +3412,10 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) { lfs_cache_zero(lfs, &lfs->rcache); lfs_cache_zero(lfs, &lfs->pcache); - // setup lookahead, must be multiple of 64-bits + // setup lookahead, must be multiple of 64-bits, 32-bit aligned LFS_ASSERT(lfs->cfg->lookahead_size > 0); LFS_ASSERT(lfs->cfg->lookahead_size % 8 == 0 && - (uintptr_t)lfs->cfg->lookahead_buffer % 8 == 0); + (uintptr_t)lfs->cfg->lookahead_buffer % 4 == 0); if (lfs->cfg->lookahead_buffer) { lfs->free.buffer = lfs->cfg->lookahead_buffer; } else {