diff options
author | dzwdz | 2022-04-12 19:44:38 +0200 |
---|---|---|
committer | dzwdz | 2022-04-12 19:44:38 +0200 |
commit | 008ac1574e127162f095a75f63c4c1be5d03b6d0 (patch) | |
tree | 23c7d249ec1e7b3ca85562a0e4a62a9221fb298c /src/kernel/syscalls.c | |
parent | 75ec633805db108bfddb6454ff7f8d812475feaf (diff) |
kernel: make all sizes unsigned, sort out the sign mess
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r-- | src/kernel/syscalls.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 85db57a..dfd7dd4 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -125,7 +125,7 @@ fail: return -1; } -int _syscall_read(handle_t handle_num, void __user *buf, int len, int offset) { +int _syscall_read(handle_t handle_num, void __user *buf, size_t len, int offset) { struct handle *handle = &process_current->handles[handle_num]; if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1; if (handle->type != HANDLE_FILE) return -1; @@ -142,7 +142,7 @@ int _syscall_read(handle_t handle_num, void __user *buf, int len, int offset) { }); } -int _syscall_write(handle_t handle_num, const void __user *buf, int len, int offset) { +int _syscall_write(handle_t handle_num, const void __user *buf, size_t len, int offset) { struct handle *handle = &process_current->handles[handle_num]; if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1; if (handle->type != HANDLE_FILE) return -1; @@ -228,8 +228,7 @@ int _syscall_fs_respond(char __user *buf, int ret) { if (req->output.len > 0 && ret > 0) { // if this vfsop outputs data and ret is positive, it's the length of the buffer // TODO document - if (ret > req->output.len) - ret = req->output.len; // i'm not handling this in a special way - the fs server can prevent this on its own + ret = min(ret, capped_cast32(req->output.len)); if (!virt_cpy(req->caller->pages, req->output.buf, process_current->pages, buf, ret)) { // how should this error even be handled? TODO |