diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index e0ce2b084..d7632002e 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -808,7 +808,13 @@ _sock_flush(struct spdk_sock *sock) return rc; } - psock->sendmsg_idx++; + /* Handling overflow case, because we use psock->sendmsg_idx - 1 for the + * req->internal.offset, so sendmsg_idx should not be zero */ + if (spdk_unlikely(psock->sendmsg_idx == UINT32_MAX)) { + psock->sendmsg_idx = 1; + } else { + psock->sendmsg_idx++; + } /* Consume the requests that were actually written */ req = TAILQ_FIRST(&sock->queued_reqs);