Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring: fix incorrect unlikely() usage in io_waitid_prep()

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>

authored by

Alok Tiwari and committed by
Jens Axboe
4ec703ec 18d6b174

+1 -1
+1 -1
io_uring/waitid.c
··· 250 250 return -EINVAL; 251 251 252 252 iwa = io_uring_alloc_async_data(NULL, req); 253 - if (!unlikely(iwa)) 253 + if (unlikely(!iwa)) 254 254 return -ENOMEM; 255 255 iwa->req = req; 256 256