tkaratapanis commented on code in PR #16734: URL: https://github.com/apache/nuttx/pull/16734#discussion_r2229392329
########## drivers/misc/optee.c: ########## @@ -980,49 +1031,34 @@ optee_ioctl_shm_alloc(FAR struct optee_priv_data *priv, FAR struct tee_ioctl_shm_alloc_data *data) { FAR struct optee_shm *shm; - FAR void *addr; - int memfd; int ret; if (!optee_is_valid_range(data, sizeof(*data))) { return -EFAULT; } - memfd = memfd_create(OPTEE_SERVER_PATH, O_CREAT | O_CLOEXEC); - if (memfd < 0) + ret = optee_shm_alloc(priv, NULL, data->size, TEE_SHM_USER_MAP, &shm); + if (ret < 0) { - return get_errno(); + return ret; } - if (ftruncate(memfd, data->size) < 0) - { - ret = get_errno(); - goto err; - } + ret = file_allocate_from_inode(&g_optee_shm_inode, + O_CLOEXEC | O_RDOK, 0, shm, 0); Review Comment: I am not sure if it's needed, `| O_RDOK`, is necessary otherwise the mapping fails, however I have tested that I can write normally only with `O_RDOK` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org