Martin Natano
2016-01-02 13:41:44 UTC
Below a diff to convert tmpfs/tmpfs_{subr,vnops}.c. That's an easy one.
Nearly all the relevant size variables already are a size_t, or a
smaller unsigned type. In the last hunk tn_size (an off_t) might be
passed to uiomove(), which is not problematic, because tn_size is
constrained to only hold values which are also representable by a
size_t.
cheers,
natano
Index: tmpfs_subr.c
===================================================================
RCS file: /cvs/src/sys/tmpfs/tmpfs_subr.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 tmpfs_subr.c
--- tmpfs_subr.c 17 Apr 2015 04:43:21 -0000 1.14
+++ tmpfs_subr.c 1 Jan 2016 15:47:39 -0000
@@ -740,7 +740,7 @@ tmpfs_dir_getdotents(tmpfs_node_t *node,
return EJUSTRETURN;
}
- if ((error = uiomovei(dp, dp->d_reclen, uio)) != 0) {
+ if ((error = uiomove(dp, dp->d_reclen, uio)) != 0) {
return error;
}
@@ -837,7 +837,7 @@ tmpfs_dir_getdents(tmpfs_node_t *node, s
}
/* Copy out the directory entry and continue. */
- error = uiomovei(&dent, dent.d_reclen, uio);
+ error = uiomove(&dent, dent.d_reclen, uio);
if (error) {
break;
}
@@ -1225,7 +1225,7 @@ tmpfs_uiomove(tmpfs_node_t *node, struct
if (pgoff + len < PAGE_SIZE) {
va = tmpfs_uio_lookup(node, pgnum);
if (va != (vaddr_t)NULL)
- return uiomovei((void *)va + pgoff, len, uio);
+ return uiomove((void *)va + pgoff, len, uio);
}
if (len >= TMPFS_UIO_MAXBYTES) {
@@ -1249,7 +1249,7 @@ tmpfs_uiomove(tmpfs_node_t *node, struct
return error;
}
- error = uiomovei((void *)va + pgoff, sz, uio);
+ error = uiomove((void *)va + pgoff, sz, uio);
if (error == 0 && pgoff + sz < PAGE_SIZE)
tmpfs_uio_cache(node, pgnum, va);
else
Index: tmpfs_vnops.c
===================================================================
RCS file: /cvs/src/sys/tmpfs/tmpfs_vnops.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 tmpfs_vnops.c
--- tmpfs_vnops.c 8 Dec 2015 15:26:25 -0000 1.23
+++ tmpfs_vnops.c 1 Jan 2016 15:47:52 -0000
@@ -1017,7 +1017,7 @@ tmpfs_readlink(void *v)
KASSERT(vp->v_type == VLNK);
node = VP_TO_TMPFS_NODE(vp);
- error = uiomovei(node->tn_spec.tn_lnk.tn_link,
+ error = uiomove(node->tn_spec.tn_lnk.tn_link,
MIN(node->tn_size, uio->uio_resid), uio);
tmpfs_update(node, TMPFS_NODE_ACCESSED);
Nearly all the relevant size variables already are a size_t, or a
smaller unsigned type. In the last hunk tn_size (an off_t) might be
passed to uiomove(), which is not problematic, because tn_size is
constrained to only hold values which are also representable by a
size_t.
cheers,
natano
Index: tmpfs_subr.c
===================================================================
RCS file: /cvs/src/sys/tmpfs/tmpfs_subr.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 tmpfs_subr.c
--- tmpfs_subr.c 17 Apr 2015 04:43:21 -0000 1.14
+++ tmpfs_subr.c 1 Jan 2016 15:47:39 -0000
@@ -740,7 +740,7 @@ tmpfs_dir_getdotents(tmpfs_node_t *node,
return EJUSTRETURN;
}
- if ((error = uiomovei(dp, dp->d_reclen, uio)) != 0) {
+ if ((error = uiomove(dp, dp->d_reclen, uio)) != 0) {
return error;
}
@@ -837,7 +837,7 @@ tmpfs_dir_getdents(tmpfs_node_t *node, s
}
/* Copy out the directory entry and continue. */
- error = uiomovei(&dent, dent.d_reclen, uio);
+ error = uiomove(&dent, dent.d_reclen, uio);
if (error) {
break;
}
@@ -1225,7 +1225,7 @@ tmpfs_uiomove(tmpfs_node_t *node, struct
if (pgoff + len < PAGE_SIZE) {
va = tmpfs_uio_lookup(node, pgnum);
if (va != (vaddr_t)NULL)
- return uiomovei((void *)va + pgoff, len, uio);
+ return uiomove((void *)va + pgoff, len, uio);
}
if (len >= TMPFS_UIO_MAXBYTES) {
@@ -1249,7 +1249,7 @@ tmpfs_uiomove(tmpfs_node_t *node, struct
return error;
}
- error = uiomovei((void *)va + pgoff, sz, uio);
+ error = uiomove((void *)va + pgoff, sz, uio);
if (error == 0 && pgoff + sz < PAGE_SIZE)
tmpfs_uio_cache(node, pgnum, va);
else
Index: tmpfs_vnops.c
===================================================================
RCS file: /cvs/src/sys/tmpfs/tmpfs_vnops.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 tmpfs_vnops.c
--- tmpfs_vnops.c 8 Dec 2015 15:26:25 -0000 1.23
+++ tmpfs_vnops.c 1 Jan 2016 15:47:52 -0000
@@ -1017,7 +1017,7 @@ tmpfs_readlink(void *v)
KASSERT(vp->v_type == VLNK);
node = VP_TO_TMPFS_NODE(vp);
- error = uiomovei(node->tn_spec.tn_lnk.tn_link,
+ error = uiomove(node->tn_spec.tn_lnk.tn_link,
MIN(node->tn_size, uio->uio_resid), uio);
tmpfs_update(node, TMPFS_NODE_ACCESSED);