Skip to content

chore: fix iov_len type in read/write apis#73

Merged
vadimskipin merged 1 commit into
ClickHouse:mainfrom
kavirajk:kavirajk/fix-iov-len
Jun 15, 2026
Merged

chore: fix iov_len type in read/write apis#73
vadimskipin merged 1 commit into
ClickHouse:mainfrom
kavirajk:kavirajk/fix-iov-len

Conversation

@kavirajk

Copy link
Copy Markdown
Contributor

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 (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_t on 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-32 and -Wimplicit-int-conversion for future regression. But that is causing so many noise from dependencies. Better to take it as follow up PR.

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 vadimskipin merged commit a7e80b0 into ClickHouse:main Jun 15, 2026
14 checks passed
@kavirajk kavirajk deleted the kavirajk/fix-iov-len branch June 15, 2026 09:16
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants