diff --git a/fs/shm/shmfs_alloc.c b/fs/shm/shmfs_alloc.c index a6bd4affad32d..05f3ff9d0cfcc 100644 --- a/fs/shm/shmfs_alloc.c +++ b/fs/shm/shmfs_alloc.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -54,7 +55,8 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length) size_t cachesize = up_get_dcache_linesize(); if (cachesize > 0) { - object->paddr = fs_heap_memalign(cachesize, length); + object->paddr = fs_heap_memalign(cachesize, + ALIGN_UP(length, cachesize)); } else { @@ -78,7 +80,8 @@ FAR struct shmfs_object_s *shmfs_alloc_object(size_t length) size_t cachesize = up_get_dcache_linesize(); if (cachesize > 0) { - object->paddr = kumm_memalign(cachesize, length); + object->paddr = kumm_memalign(cachesize, + ALIGN_UP(length, cachesize)); } else {