summaryrefslogtreecommitdiff
path: root/src/include/liburing.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-12-04 15:07:18 -0700
committerJens Axboe <axboe@kernel.dk>2021-12-04 15:07:18 -0700
commita49427fbbe0a2b25cefd77d9a78df2b7d96d661f (patch)
tree27769bc0f04f77d4e662f794af19931e14c4bc90 /src/include/liburing.h
parent02158b6ae281776b4db2a5409524f16cc1488fb9 (diff)
downloadliburing-a49427fbbe0a2b25cefd77d9a78df2b7d96d661f.tar.gz
liburing-a49427fbbe0a2b25cefd77d9a78df2b7d96d661f.tar.bz2
liburing.h: don't truncate timeout_update/remove user data value
If we're running on 32-bit, with the cast that io_uring_prep_rw() does, we lose the top 32 bits of the user_data for the timeout remove and update commands. If the application also uses a full 64-bit value for the original timeout user_data, then we cannot find the timeout to update. Link: https://github.com/axboe/liburing/issues/490 Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'src/include/liburing.h')
-rw-r--r--src/include/liburing.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 169e098..230cd61 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -425,8 +425,8 @@ static inline void io_uring_prep_timeout(struct io_uring_sqe *sqe,
static inline void io_uring_prep_timeout_remove(struct io_uring_sqe *sqe,
__u64 user_data, unsigned flags)
{
- io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, -1,
- (void *)(unsigned long)user_data, 0, 0);
+ io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, -1, NULL, 0, 0);
+ sqe->addr = user_data;
sqe->timeout_flags = flags;
}
@@ -434,9 +434,9 @@ static inline void io_uring_prep_timeout_update(struct io_uring_sqe *sqe,
struct __kernel_timespec *ts,
__u64 user_data, unsigned flags)
{
- io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, -1,
- (void *)(unsigned long)user_data, 0,
- (uintptr_t)ts);
+ io_uring_prep_rw(IORING_OP_TIMEOUT_REMOVE, sqe, -1, NULL, 0,
+ (uintptr_t) ts);
+ sqe->addr = user_data;
sqe->timeout_flags = flags | IORING_TIMEOUT_UPDATE;
}