@@ -791,10 +791,9 @@ static inline void io_uring_prep_recv_multishot(struct io_uring_sqe *sqe,
static inline struct io_uring_recvmsg_out *
io_uring_recvmsg_validate(void *buf, int buf_len, struct msghdr *msgh)
{
- int header = msgh->msg_controllen + msgh->msg_namelen +
+ unsigned long header = msgh->msg_controllen + msgh->msg_namelen +
sizeof(struct io_uring_recvmsg_out);
-
- if (buf_len < header)
+ if (buf_len < 0 || (unsigned long)buf_len < header)
return NULL;
return (struct io_uring_recvmsg_out *)buf;
}
Fix for compilers running with -Wshorten-64-to-32 Fixes: 874406f7fb09 ("add multishot recvmsg API") Signed-off-by: Dylan Yudaken <dylany@meta.com> --- src/include/liburing.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)