]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:10:28 +0000 (14:10 +0100)
[ Upstream commit 4ec703ec0c384a2199808c4eb2e9037236285a8d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/waitid.c

index 3101ad8ec0cf6277ddcef193255921992579805a..c8ca00e681f77b44ddf431c96cc26f20a0e6fa9a 100644 (file)
@@ -252,7 +252,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;