io_uring: shut io_prep_async_work warning
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 11 Apr 2023 11:06:01 +0000 (12:06 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Apr 2023 18:09:41 +0000 (12:09 -0600)
io_uring/io_uring.c:432 io_prep_async_work() error: we previously
assumed 'req->file' could be null (see line 425).

Even though it's a false positive as there will not be REQ_F_ISREG set
without a file, let's add a simple check to make the kernel test robot
happy. We don't care about performance here, but assumingly it'll be
optimised out by the compiler.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/a6cfbe92c74b789c0b4f046f7f98d19b1ca2e5b7.1681210788.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index 9bbf582..b171c26 100644 (file)
@@ -425,7 +425,7 @@ static void io_prep_async_work(struct io_kiocb *req)
        if (req->file && !io_req_ffs_set(req))
                req->flags |= io_file_get_flags(req->file) << REQ_F_SUPPORT_NOWAIT_BIT;
 
-       if (req->flags & REQ_F_ISREG) {
+       if (req->file && (req->flags & REQ_F_ISREG)) {
                bool should_hash = def->hash_reg_file;
 
                /* don't serialize this request if the fs doesn't need it */