From 5fda37c7827a1baa7a94482b690c90f4473a40e9 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 10 Apr 2024 02:35:50 -0400 Subject: kernel: filedesc: Check fd_desc before using it Signed-off-by: Ian Moffett --- sys/kern/kern_filedesc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index 4eab0ae..3401f0b 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -324,12 +324,11 @@ read(int fd, void *buf, size_t count) }; fd_desc = fd_from_fdnum(this_td(), fd); - sio.offset = fd_desc->offset; - if (fd_desc == NULL) { return -EBADF; } + sio.offset = fd_desc->offset; vnode = fd_desc->vnode; if (count > MAX_RW_SIZE) { -- cgit v1.2.3