From 7f4529a217f32dace81eec920923513fa30d1373 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 21 Nov 2025 16:56:12 +0100 Subject: [PATCH] fast-get: fix userspace Fix userspace z_vrfy_* implementations. Signed-off-by: Guennadi Liakhovetski --- zephyr/lib/fast-get.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zephyr/lib/fast-get.c b/zephyr/lib/fast-get.c index d23616541745..c3c70c1ee438 100644 --- a/zephyr/lib/fast-get.c +++ b/zephyr/lib/fast-get.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -171,10 +172,10 @@ void z_impl_fast_put(struct k_heap *heap, const void *sram_ptr) EXPORT_SYMBOL(z_impl_fast_put); #ifdef CONFIG_USERSPACE +#include void z_vrfy_fast_put(struct k_heap *heap, const void *sram_ptr) { K_OOPS(K_SYSCALL_MEMORY_WRITE(heap, sizeof(*heap))); - K_OOPS(K_SYSCALL_MEMORY_WRITE(heap->heap.heap, sizeof(*heap->heap.heap))); /* * FIXME: we don't know how much SRAM has been allocated, so cannot * check. Should fast_put() be changed to pass a size argument? @@ -182,16 +183,15 @@ void z_vrfy_fast_put(struct k_heap *heap, const void *sram_ptr) z_impl_fast_put(heap, sram_ptr); } -#include +#include const void *z_vrfy_fast_get(struct k_heap *heap, const void *dram_ptr, size_t size) { K_OOPS(K_SYSCALL_MEMORY_WRITE(heap, sizeof(*heap))); - K_OOPS(K_SYSCALL_MEMORY_WRITE(heap->heap.heap, sizeof(*heap->heap.heap))); /* We cannot (easily) verify the actual heapp memory */ K_OOPS(K_SYSCALL_MEMORY_READ(dram_ptr, size)); return z_impl_fast_get(heap, dram_ptr, size); } -#include +#include #endif