summaryrefslogtreecommitdiffstats
path: root/sys/compat/cloudabi64/cloudabi64_fd.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-10-12 11:41:26 -0300
committerRenato Botelho <renato@netgate.com>2016-10-12 11:41:26 -0300
commitcb642130dfc50717bb970a104c44aa7690930a38 (patch)
treec67f108534217a209198c6b201949ecc73acaba3 /sys/compat/cloudabi64/cloudabi64_fd.c
parent5dd7ab172435dc99e1abc1f7d73fd5e720050bbc (diff)
parentcd04fbc5e631c6b3e80a14eb7044c3be35fba2d2 (diff)
downloadFreeBSD-src-cb642130dfc50717bb970a104c44aa7690930a38.zip
FreeBSD-src-cb642130dfc50717bb970a104c44aa7690930a38.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'sys/compat/cloudabi64/cloudabi64_fd.c')
-rw-r--r--sys/compat/cloudabi64/cloudabi64_fd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/compat/cloudabi64/cloudabi64_fd.c b/sys/compat/cloudabi64/cloudabi64_fd.c
index 7d0c69a..fcfcc42 100644
--- a/sys/compat/cloudabi64/cloudabi64_fd.c
+++ b/sys/compat/cloudabi64/cloudabi64_fd.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <contrib/cloudabi/cloudabi64_types.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
+#include <compat/cloudabi64/cloudabi64_util.h>
/* Copies in 64-bit iovec structures from userspace. */
static int
@@ -70,9 +71,9 @@ cloudabi64_copyinuio(const cloudabi64_iovec_t *iovp, size_t iovcnt,
free(uio, M_IOV);
return (error);
}
- iov[i].iov_base = (void *)iovobj.iov_base;
+ iov[i].iov_base = TO_PTR(iovobj.iov_base);
iov[i].iov_len = iovobj.iov_len;
- if (iov[i].iov_len > SSIZE_MAX - uio->uio_resid) {
+ if (iov[i].iov_len > INT64_MAX - uio->uio_resid) {
free(uio, M_IOV);
return (EINVAL);
}
@@ -105,8 +106,7 @@ cloudabi64_sys_fd_pwrite(struct thread *td,
struct uio *uio;
int error;
- error = cloudabi64_copyinuio((const cloudabi64_iovec_t *)uap->iov,
- uap->iovcnt, &uio);
+ error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
if (error != 0)
return (error);
error = kern_pwritev(td, uap->fd, uio, uap->offset);
@@ -136,8 +136,7 @@ cloudabi64_sys_fd_write(struct thread *td,
struct uio *uio;
int error;
- error = cloudabi64_copyinuio((const cloudabi64_iovec_t *)uap->iov,
- uap->iovcnt, &uio);
+ error = cloudabi64_copyinuio(TO_PTR(uap->iov), uap->iovcnt, &uio);
if (error != 0)
return (error);
error = kern_writev(td, uap->fd, uio);
OpenPOWER on IntegriCloud