diff options
author | Sean Anderson | 2023-11-08 11:48:41 -0500 |
---|---|---|
committer | Tom Rini | 2023-11-16 13:49:14 -0500 |
commit | b63664be6a3d829639f8635365f22f4e1dd30aa1 (patch) | |
tree | a4a3558370c7be43bc58f60aecad0036d32fe42c /common/spl/spl_imx_container.c | |
parent | 73c40fcb7367f5a431c987f7da0420c058a939fc (diff) |
spl: Set FAT bl_len to ARCH_DMA_MINALIGN
Instead of relying on the presence of filename to determine whether we are
dealing with a FAT filesystem (and should DMA-align the buffer), have FAT set
bl_len to ARCH_DMA_MINALIGN instead. With this done, we can remove the
special-case logic checking for the presence of filename.
Because filesystems are not block-based, we may read less than the size passed
to spl_load_info.read. This can happen if the file size is not DMA-aligned. This
is fine as long as we read the amount we originally wanted to. Modify the
conditions for callers of spl_load_info.read to check against the original,
unaligned size to avoid failing spuriously.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/spl/spl_imx_container.c')
-rw-r--r-- | common/spl/spl_imx_container.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/spl/spl_imx_container.c b/common/spl/spl_imx_container.c index ad89a99fb23..7cd674f835f 100644 --- a/common/spl/spl_imx_container.c +++ b/common/spl/spl_imx_container.c @@ -45,7 +45,8 @@ static struct boot_img_t *read_auth_image(struct spl_image_info *spl_image, container, offset, size); if (info->read(info, offset, size, map_sysmem(images[image_index].dst - overhead, - images[image_index].size)) != size) { + images[image_index].size)) < + images[image_index].size) { printf("%s wrong\n", __func__); return NULL; } @@ -77,7 +78,8 @@ static int read_auth_container(struct spl_image_info *spl_image, debug("%s: container: %p offset: %lu size: %u\n", __func__, container, offset, size); - if (info->read(info, offset, size, container) != size) { + if (info->read(info, offset, size, container) < + CONTAINER_HDR_ALIGNMENT) { ret = -EIO; goto end; } @@ -107,7 +109,7 @@ static int read_auth_container(struct spl_image_info *spl_image, debug("%s: container: %p offset: %lu size: %u\n", __func__, container, offset, size); - if (info->read(info, offset, size, container) != size) { + if (info->read(info, offset, size, container) < length) { ret = -EIO; goto end; } |