yamt commented on code in PR #14898:
URL: https://github.com/apache/nuttx/pull/14898#discussion_r1883386576
##########
fs/vfs/fs_uio.c:
##########
@@ -117,3 +117,97 @@ void uio_init(FAR struct uio *uio)
{
memset(uio, 0, sizeof(*uio));
}
+
+/****************************************************************************
+ * Name: uio_copyfrom
+ *
+ * Description:
+ * Copy data from the linear buffer to uio.
+ *
+ ****************************************************************************/
+
+void uio_copyfrom(FAR struct uio *uio, size_t offset, FAR const void *buf,
+ size_t len)
+{
+ FAR const struct iovec *iov = uio->uio_iov;
+
+ DEBUGASSERT(uio_resid(uio) >= 0);
+ DEBUGASSERT(len <= uio_resid(uio));
+ DEBUGASSERT(offset <= uio_resid(uio) - len);
+ DEBUGASSERT(SSIZE_MAX - offset >= uio->uio_offset_in_iov);
Review Comment:
it was intentional to use SSIZE_MAX here.
i don't think we can support sizes larger than SSIZE_MAX in general as far
as we use api like readv() which signals errors with negative ssize_t. (-1)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]