diff --git a/folly/io/async/IoUring.cpp b/folly/io/async/IoUring.cpp index 2092da6e698..98ae34320ac 100644 --- a/folly/io/async/IoUring.cpp +++ b/folly/io/async/IoUring.cpp @@ -114,7 +114,9 @@ void toStream(std::ostream& os, const struct io_uring_sqe& sqe) { namespace folly { IoUringOp::IoUringOp(NotificationCallback cb, Options options) - : AsyncBaseOp(std::move(cb)), options_(options) {} + : AsyncBaseOp(std::move(cb)), options_(options) { + ::memset(iov_, 0, sizeof(iov_)); +} void IoUringOp::reset(NotificationCallback cb) { CHECK_NE(state_, State::PENDING); diff --git a/folly/io/async/IoUring.h b/folly/io/async/IoUring.h index 9e1d1592587..88f34ab51e6 100644 --- a/folly/io/async/IoUring.h +++ b/folly/io/async/IoUring.h @@ -112,14 +112,14 @@ class IoUringOp : public AsyncBaseOp { union { struct io_uring_sqe sqe; uint8_t data[128]; - } sqe_; + } sqe_ = {}; // we have to use a union here because of -Wgnu-variable-sized-type-not-at-end //__u64 big_cqe[]; union { __u64 user_data; // first member from from io_uring_cqe uint8_t data[32]; - } cqe_; + } cqe_ = {}; struct iovec iov_[1]; };