diff options
author | dzwdz | 2021-11-04 07:35:23 +0000 |
---|---|---|
committer | dzwdz | 2021-11-04 07:35:23 +0000 |
commit | d9b7a1a5d222a618b7530ecfa42b1ccb4f9a5f4c (patch) | |
tree | 99732f38912a7db5bf8fabc610a03a9ca366a4be /src/kernel/syscalls.c | |
parent | 0c24ed6eb939bd68c9a882d21fd45e2079e1bb66 (diff) | |
parent | e0ddaaa6290f74fcce6e067c1e5f1c9c87974f4c (diff) |
Merge branch 'main' into fork2
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 5cee090..9a9b5d6 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -49,10 +49,8 @@ handle_t _syscall_open(const char __user *path, int len) { if (process_find_handle(process_current) < 0) return -1; - // copy the path to the kernel, simplify it - path_buf = kmalloc(len); // gets freed in vfs_request_finish - if (!virt_cpy_from(process_current->pages, path_buf, path, len)) - goto fail; + path_buf = virt_cpy2kmalloc(process_current->pages, path, len); + if (!path_buf) goto fail; len = path_simplify(path_buf, path_buf, len); if (len < 0) goto fail; @@ -90,9 +88,9 @@ int _syscall_mount(handle_t handle, const char __user *path, int len) { if (PATH_MAX < len) return -1; // copy the path to the kernel to simplify it - path_buf = kmalloc(len); - if (!virt_cpy_from(process_current->pages, path_buf, path, len)) - goto fail; + path_buf = virt_cpy2kmalloc(process_current->pages, path, len); + if (!path_buf) goto fail; + len = path_simplify(path_buf, path_buf, len); if (len < 0) goto fail; |