io_uring/rw: remove dead file == NULL check
authorJens Axboe <axboe@kernel.dk>
Mon, 29 Jan 2024 03:52:21 +0000 (20:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Feb 2024 20:27:06 +0000 (13:27 -0700)
Any read/write opcode has needs_file == true, which means that we
would've failed the request long before reaching the issue stage if we
didn't successfully assign a file. This check has been dead forever,
and is really a leftover from generic code.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rw.c

index 0fb7a045163ae7c58d0da639db4e26c30fea972d..8ba93fffc23acad10b5ad56a9de036d1a85810fc 100644 (file)
@@ -721,7 +721,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
        struct file *file = req->file;
        int ret;
 
-       if (unlikely(!file || !(file->f_mode & mode)))
+       if (unlikely(!(file->f_mode & mode)))
                return -EBADF;
 
        if (!(req->flags & REQ_F_FIXED_FILE))