diff options
author | dzwdz | 2023-01-25 01:02:04 +0100 |
---|---|---|
committer | dzwdz | 2023-01-25 01:04:49 +0100 |
commit | 2a2fc4dffe0117ce874a6cf1dcc34321ed8add77 (patch) | |
tree | af1e24f72241dbbff97797b9e186f7d27b5b54b4 /src/kernel/arch/amd64/driver/serial.c | |
parent | 52e7fe3c679469032e77a5ca4adf19618ba1201b (diff) |
kernel/virt: replace the virt_cpy api with a more foolproof one
Diffstat (limited to 'src/kernel/arch/amd64/driver/serial.c')
-rw-r--r-- | src/kernel/arch/amd64/driver/serial.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/kernel/arch/amd64/driver/serial.c b/src/kernel/arch/amd64/driver/serial.c index 295f9b8..12c4151 100644 --- a/src/kernel/arch/amd64/driver/serial.c +++ b/src/kernel/arch/amd64/driver/serial.c @@ -73,13 +73,14 @@ static void accept(struct vfs_request *req) { break; case VFSOP_WRITE: if (req->caller && !req->flags) { - struct virt_iter iter; - virt_iter_new(&iter, req->input.buf, req->input.len, - req->caller->pages, true, false); - while (virt_iter_next(&iter)) - serial_write(iter.frag, iter.frag_len); - ret = iter.prior; - } else ret = -1; + char buf[4096]; + size_t len = min(sizeof buf, req->input.len); + len = pcpy_from(req->caller, buf, req->input.buf, len); + serial_write(buf, len); + ret = len; + } else { + ret = -1; + } vfsreq_finish_short(req, ret); break; default: |