diff options
author | Ian Moffett <ian@osmora.org> | 2024-04-10 02:35:50 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-04-10 02:35:50 -0400 |
commit | 5fda37c7827a1baa7a94482b690c90f4473a40e9 (patch) | |
tree | 9d254a88a0a2c611c72b5e1eebfec958f6b62b67 | |
parent | 0b791845261095186c70cd3ce7f819e528c289c8 (diff) |
kernel: filedesc: Check fd_desc before using it
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r-- | sys/kern/kern_filedesc.c | 3 |
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) { |