aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_filedesc.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-10 02:35:50 -0400
committerIan Moffett <ian@osmora.org>2024-04-10 02:35:50 -0400
commit5fda37c7827a1baa7a94482b690c90f4473a40e9 (patch)
tree9d254a88a0a2c611c72b5e1eebfec958f6b62b67 /sys/kern/kern_filedesc.c
parent0b791845261095186c70cd3ce7f819e528c289c8 (diff)
kernel: filedesc: Check fd_desc before using it
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_filedesc.c')
-rw-r--r--sys/kern/kern_filedesc.c3
1 files changed, 1 insertions, 2 deletions
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) {