You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/03/24 07:39:20 UTC
(nuttx) 06/09: imx9: usdhc fix dmapreflight rejecting small unaligned buffers
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 9e048af2c38f6c06f766e2ef3f7d10f7ce468d60
Author: buxiasen <bu...@xiaomi.com>
AuthorDate: Fri Mar 6 15:51:37 2026 +0800
imx9: usdhc fix dmapreflight rejecting small unaligned buffers
imx9_dmapreflight() rejected unaligned buffers unconditionally, but
dmarecvsetup() has a bounce path via priv->rxbuffer for small
transfers. Add a buflen > sizeof(priv->rxbuffer) check so that
small reads (e.g. ext_csd 512-byte stack buffer) can use the
bounce buffer instead of failing with -EFAULT.
Signed-off-by: buxiasen <bu...@xiaomi.com>
---
arch/arm64/src/imx9/imx9_usdhc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/src/imx9/imx9_usdhc.c b/arch/arm64/src/imx9/imx9_usdhc.c
index d9c26c000f4..83fa0585a47 100644
--- a/arch/arm64/src/imx9/imx9_usdhc.c
+++ b/arch/arm64/src/imx9/imx9_usdhc.c
@@ -3131,6 +3131,7 @@ static int imx9_dmapreflight(struct sdio_dev_s *dev,
*/
if (buffer != priv->rxbuffer &&
+ buflen > sizeof(priv->rxbuffer) &&
(((uintptr_t)buffer & (USDHC_DATABUF_ALIGN - 1)) != 0 ||
((uintptr_t)(buffer + buflen) & (USDHC_DATABUF_ALIGN - 1)) != 0))
{