size_t shim_do_write (int fd, const void * buf, size_t count) { struct shim_handle * hdl = get_fd_handle(fd, NULL, NULL); if (!hdl) return -EBADF; int ret = do_handle_write(hdl, buf, count); put_handle(hdl); return ret; }
size_t shim_do_write (int fd, const void * buf, size_t count) { if (!buf || test_user_memory((void *) buf, count, false)) return -EFAULT; struct shim_handle * hdl = get_fd_handle(fd, NULL, NULL); if (!hdl) return -EBADF; int ret = do_handle_write(hdl, buf, count); put_handle(hdl); return ret; }