chore: fix iov_len type in read/write apis#73
Merged
Conversation
read/write apis accept iov_len as uint64_t type. But it's un-necessary. Even the original iouring api prep_readv and prep_writev accept this as unsigned (32-bit) value. Currently this does "silent" convertion and it's bad.
vadimskipin
approved these changes
Jun 15, 2026
vadimskipin
pushed a commit
that referenced
this pull request
Jun 18, 2026
follow up to #73 Added some compiler flags to avoid such silent converstions in the future. Played with different options and these combinations seems to be practical at the moment without much noise. Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read/write apis accept
iov_lenasuint64_ttype. But it's un-necessary.Even the original iouring api prep_readv and prep_writev accept this as unsigned (32-bit) value (
unsigned nbytes).Currently this does "silent" conversion and it's bad.
It all boils down to the original type of
sqe's io_vec length's type. Which is still u32 according to man page.__u32 len; /* buffer size or number of iovecs */So this
uint64_ton the public api is un-necessary and set wrong expectations (io_vec length cannot be more than 2^32).FYI: I tried to add compile flags like
-Wshorten-64-to-32and-Wimplicit-int-conversionfor future regression. But that is causing so many noise from dependencies. Better to take it as follow up PR.