Skip to content

Commit

Permalink
Fix off-by-one in minor check for io_uring_check_version()
Browse files Browse the repository at this point in the history
Ditto for the compile time version, IO_URING_CHECK_VERSION(). If
the majors are the same, only if the major is larger should we return
true.

Both of them really work the opposite way of what you'd expect, at
least logically. But better to leave them alone at this point and just
ensure the documentation is correct.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
axboe committed Feb 27, 2024
1 parent 1e8eae4 commit 3aa6515
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/include/liburing.h
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ bool io_uring_check_version(int major, int minor);
#define IO_URING_CHECK_VERSION(major,minor) \
(major > IO_URING_VERSION_MAJOR || \
(major == IO_URING_VERSION_MAJOR && \
minor >= IO_URING_VERSION_MINOR))
minor > IO_URING_VERSION_MINOR))

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ bool io_uring_check_version(int major, int minor)
{
return major > io_uring_major_version() ||
(major == io_uring_major_version() &&
minor >= io_uring_minor_version());
minor > io_uring_minor_version());
}

0 comments on commit 3aa6515

Please sign in to comment.