From 262311a02c4bcf001d1b2a4ce496a5a83ec4f9e1 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 21 Sep 2021 18:11:10 +0200 Subject: implement (safe) min/max macros --- src/kernel/vfs/request.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src/kernel/vfs/request.c') diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c index fcd6c47..9826982 100644 --- a/src/kernel/vfs/request.c +++ b/src/kernel/vfs/request.c @@ -47,12 +47,7 @@ _Noreturn void vfs_request_pass2handler(struct vfs_request *req) { handler->state = PS_RUNNING; handler->handled_req = req; - len = handler->awaited_req.max_len; - if (len > req->input.len) { - // input bigger than buffer - // TODO what should be done during e.g. open() calls? truncating doesn't seem right - len = req->input.len; - } + len = min(req->input.len, handler->awaited_req.max_len); if (req->input.kern) { if (!virt_cpy_to(handler->pages, -- cgit v1.2.3