summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver
diff options
context:
space:
mode:
authordzwdz2023-09-29 22:00:07 +0200
committerdzwdz2023-09-29 22:00:07 +0200
commiteccd9d6d23f15a37ad118897d167dd18973242a1 (patch)
tree8d9a1986960aeee00fae170c13159eec2fd998bb /src/kernel/arch/amd64/driver
parentdf9343bb9ea8311a0f0ea0cd37d91013ce59f2f9 (diff)
kernel: fix linked list iteration in postqueue
Diffstat (limited to 'src/kernel/arch/amd64/driver')
-rw-r--r--src/kernel/arch/amd64/driver/util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c
index 1462258..0f0ee34 100644
--- a/src/kernel/arch/amd64/driver/util.c
+++ b/src/kernel/arch/amd64/driver/util.c
@@ -42,7 +42,10 @@ void postqueue_ringreadall(VfsReq **queue, ring_t *r) {
mlen = min(mlen, sizeof tmp);
mlen = ring_get(r, tmp, mlen);
- for (req = *queue; req; req = req->postqueue_next) {
+ while (*queue) {
+ req = *queue;
+ *queue = req->postqueue_next;
+
size_t ret = min(mlen, req->output.len);
assert(req->type == VFSOP_READ);
if (req->caller) {
@@ -50,7 +53,6 @@ void postqueue_ringreadall(VfsReq **queue, ring_t *r) {
}
vfsreq_finish_short(req, ret);
}
- *queue = NULL;
}
size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max) {