]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring: fix incorrect unlikely() usage in io_waitid_prep()
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Sat, 18 Oct 2025 19:32:54 +0000 (12:32 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 20 Oct 2025 15:22:09 +0000 (09:22 -0600)
The negation operator is incorrectly placed outside the unlikely()
macro:

    if (!unlikely(iwa))

This inverts the compiler branch prediction hint, marking the NULL case
as likely instead of unlikely. The intent is to indicate that allocation
failures are rare, consistent with common kernel patterns.

 Moving the negation inside unlikely():

    if (unlikely(!iwa))

Fixes: 2b4fc4cd43f2 ("io_uring/waitid: setup async data in the prep handler")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/waitid.c

index f25110fb1b1225abea26c4f35f012813291ba5a3..53532ae6256ca7c3c1f8bbee6b7e0a1547fe9d53 100644 (file)
@@ -250,7 +250,7 @@ int io_waitid_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
                return -EINVAL;
 
        iwa = io_uring_alloc_async_data(NULL, req);
-       if (!unlikely(iwa))
+       if (unlikely(!iwa))
                return -ENOMEM;
        iwa->req = req;