diff mbox series

[liburing,3/5] change io_uring_recvmsg_payload_length return type

Message ID 20220726121502.1958288-4-dylany@fb.com (mailing list archive)
State New
Headers show
Series multishot recvmsg docs and example | expand

Commit Message

Dylan Yudaken July 26, 2022, 12:15 p.m. UTC
Payloads can not be bigger than UINT_MAX, so no need to force a bigger
type on the caller.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
---
 src/include/liburing.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 9e7f06f390be..06f4a50bacb1 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -788,7 +788,7 @@  static inline void *io_uring_recvmsg_payload(struct io_uring_recvmsg_out *o,
 			msgh->msg_namelen + msgh->msg_controllen);
 }
 
-static inline size_t
+static inline unsigned int
 io_uring_recvmsg_payload_length(struct io_uring_recvmsg_out *o,
 				int buf_len, struct msghdr *msgh)
 {
@@ -796,7 +796,7 @@  io_uring_recvmsg_payload_length(struct io_uring_recvmsg_out *o,
 
 	payload_start = (unsigned long) io_uring_recvmsg_payload(o, msgh);
 	payload_end = (unsigned long) o + buf_len;
-	return payload_end - payload_start;
+	return (unsigned int) (payload_end - payload_start);
 }
 
 static inline void io_uring_prep_openat2(struct io_uring_sqe *sqe, int dfd,