[rtems-libbsd commit] MMCSD: Use cache aligned alloc for ioctl

Christian Mauderer christianm at rtems.org
Mon Apr 19 07:03:13 UTC 2021


Module:    rtems-libbsd
Branch:    6-freebsd-12
Commit:    00a5f9748e3c6757140efda393cd474881e2c7fa
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=00a5f9748e3c6757140efda393cd474881e2c7fa

Author:    Christian Mauderer <christian.mauderer at embedded-brains.de>
Date:      Tue Apr 13 13:55:11 2021 +0200

MMCSD: Use cache aligned alloc for ioctl

Some drivers can't easily work with buffers that are not cache aligned
and have an arbitrary length. Therefore use an aligned malloc instead.

---

 freebsd/sys/dev/mmc/mmcsd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/freebsd/sys/dev/mmc/mmcsd.c b/freebsd/sys/dev/mmc/mmcsd.c
index 21f5404..bd45b41 100644
--- a/freebsd/sys/dev/mmc/mmcsd.c
+++ b/freebsd/sys/dev/mmc/mmcsd.c
@@ -1196,7 +1196,11 @@ mmcsd_ioctl_cmd(struct mmcsd_part *part, struct mmc_ioc_cmd *mic, int fflag)
 		goto out;
 	}
 	if (len != 0) {
+#ifndef __rtems__
 		dp = malloc(len, M_TEMP, M_WAITOK);
+#else /* __rtems__ */
+		dp = rtems_cache_aligned_malloc(len);
+#endif /* __rtems__ */
 		err = copyin((void *)(uintptr_t)mic->data_ptr, dp, len);
 		if (err != 0)
 			goto out;



More information about the vc mailing list