summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2004-01-27 11:28:38 +0000
committerache <ache@FreeBSD.org>2004-01-27 11:28:38 +0000
commit39512497084f96e2977ef3b139345ba9264ca642 (patch)
tree8b72b09c02efa78577b4a1d764fedce480771460 /sys/ufs
parenta7d7d544988617ae648b20a1781dae5e2580636a (diff)
downloadFreeBSD-src-39512497084f96e2977ef3b139345ba9264ca642.zip
FreeBSD-src-39512497084f96e2977ef3b139345ba9264ca642.tar.gz
Turn uio_resid/uio_offset comments into KASSERTs
Reviewed by: bde
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vnops.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 848ac9d..654cc5a 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -387,13 +387,11 @@ ffs_read(ap)
panic("ffs_read: type %d", vp->v_type);
#endif
orig_resid = uio->uio_resid;
+ KASSERT(orig_resid >= 0, ("ffs_read: uio->uio_resid < 0"));
if (orig_resid == 0)
return (0);
+ KASSERT(uio->uio_offset >= 0, ("ffs_read: uio->uio_offset < 0"));
fs = ip->i_fs;
- /*
- * The caller is supposed to check if
- * uio->uio_offset >= 0 and uio->uio_resid >= 0.
- */
if (uio->uio_offset < ip->i_size &&
uio->uio_offset >= fs->fs_maxfilesize)
return (EOVERFLOW);
@@ -643,11 +641,9 @@ ffs_write(ap)
);
}
+ KASSERT(uio->uio_resid >= 0, ("ffs_write: uio->uio_resid < 0"));
+ KASSERT(uio->uio_offset >= 0, ("ffs_write: uio->uio_offset < 0"));
fs = ip->i_fs;
- /*
- * The caller is supposed to check if
- * uio->uio_offset >= 0 and uio->uio_resid >= 0.
- */
if ((uoff_t)uio->uio_offset + uio->uio_resid > fs->fs_maxfilesize) {
if (object) {
VM_OBJECT_LOCK(object);
@@ -975,12 +971,10 @@ ffs_extread(struct vnode *vp, struct uio *uio, int ioflag)
#endif
orig_resid = uio->uio_resid;
+ KASSERT(orig_resid >= 0, ("ffs_extread: uio->uio_resid < 0"));
if (orig_resid == 0)
return (0);
- /*
- * The caller is supposed to check if
- * uio->uio_offset >= 0 and uio->uio_resid >= 0.
- */
+ KASSERT(uio->uio_offset >= 0, ("ffs_extread: uio->uio_offset < 0"));
bytesinfile = dp->di_extsize - uio->uio_offset;
if (bytesinfile <= 0) {
@@ -1144,10 +1138,8 @@ ffs_extwrite(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *ucred)
if (ioflag & IO_APPEND)
uio->uio_offset = dp->di_extsize;
- /*
- * The caller is supposed to check if
- * uio->uio_offset >= 0 and uio->uio_resid >= 0.
- */
+ KASSERT(uio->uio_offset >= 0, ("ffs_extwrite: uio->uio_offset < 0"));
+ KASSERT(uio->uio_resid >= 0, ("ffs_extwrite: uio->uio_resid < 0"));
if ((uoff_t)uio->uio_offset + uio->uio_resid > NXADDR * fs->fs_bsize)
return (EFBIG);
OpenPOWER on IntegriCloud