]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
sockets.c: Use size_t for iovec length
authorAndrei Tatar <andrei@unikraft.io>
Thu, 6 Feb 2025 13:05:37 +0000 (14:05 +0100)
committerRazvan Deaconescu <razvand@unikraft.io>
Tue, 11 Feb 2025 15:42:46 +0000 (17:42 +0200)
This change updates the lwip socket read/write ops to use unsigned
size_t for the length of the passed-in iovec.

The internal lwip read/write functions still use int, and simply package
it into struct msghdr, which is size_t once again.
If overflow is a concern we should fix it with a build patch.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #61

sockets.c

index f82da50063853ef04776c7914692f4f4a628fb85..7eb0af116b4374ad677098568d40a8713eb0aae2 100644 (file)
--- a/sockets.c
+++ b/sockets.c
@@ -343,7 +343,7 @@ lwip_posix_socket_sendto(posix_sock *file, const void *buf,
 
 static ssize_t
 lwip_posix_socket_read(posix_sock *file, const struct iovec *iov,
-                      int iovcnt)
+                      size_t iovcnt)
 {
        int lwip_fd;
        ssize_t ret;
@@ -360,7 +360,7 @@ lwip_posix_socket_read(posix_sock *file, const struct iovec *iov,
 
 static ssize_t
 lwip_posix_socket_write(posix_sock *file, const struct iovec *iov,
-                      int iovcnt)
+                       size_t iovcnt)
 {
        int lwip_fd;
        ssize_t ret;