diff --git a/include/zephyr/internal/syscall_handler.h b/include/zephyr/internal/syscall_handler.h index 3a8d5ac381..336d66266d 100644 --- a/include/zephyr/internal/syscall_handler.h +++ b/include/zephyr/internal/syscall_handler.h @@ -200,7 +200,7 @@ void k_object_recycle(const void *obj); * maxlen if there were no NULL terminating characters within the * first maxlen bytes. */ -static inline size_t z_user_string_nlen(const char *src, size_t maxlen, +static inline size_t k_usermode_string_nlen(const char *src, size_t maxlen, int *err) { return arch_user_string_nlen(src, maxlen, err); diff --git a/kernel/userspace.c b/kernel/userspace.c index 6fbff3ab4e..92728ea9ef 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -858,7 +858,7 @@ char *z_user_string_alloc_copy(const char *src, size_t maxlen) int err; char *ret = NULL; - actual_len = z_user_string_nlen(src, maxlen, &err); + actual_len = k_usermode_string_nlen(src, maxlen, &err); if (err != 0) { goto out; } @@ -890,7 +890,7 @@ int z_user_string_copy(char *dst, const char *src, size_t maxlen) size_t actual_len; int ret, err; - actual_len = z_user_string_nlen(src, maxlen, &err); + actual_len = k_usermode_string_nlen(src, maxlen, &err); if (err != 0) { ret = EFAULT; goto out; diff --git a/tests/kernel/mem_protect/syscalls/src/main.c b/tests/kernel/mem_protect/syscalls/src/main.c index 35279e59a1..4ecf2aed9e 100644 --- a/tests/kernel/mem_protect/syscalls/src/main.c +++ b/tests/kernel/mem_protect/syscalls/src/main.c @@ -46,7 +46,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf) size_t z_impl_string_nlen(char *src, size_t maxlen, int *err) { - return z_user_string_nlen(src, maxlen, err); + return k_usermode_string_nlen(src, maxlen, err); } static inline size_t z_vrfy_string_nlen(char *src, size_t maxlen, int *err) @@ -193,14 +193,14 @@ static inline uint32_t z_vrfy_more_args(uint32_t arg1, uint32_t arg2, #include /** - * @brief Test to demonstrate usage of z_user_string_nlen() + * @brief Test to demonstrate usage of k_usermode_string_nlen() * * @details The test will be called from user mode and kernel - * mode to check the behavior of z_user_string_nlen() + * mode to check the behavior of k_usermode_string_nlen() * * @ingroup kernel_memprotect_tests * - * @see z_user_string_nlen() + * @see k_usermode_string_nlen() */ ZTEST_USER(syscalls, test_string_nlen) {