diff options
author | peter <peter@FreeBSD.org> | 2003-05-19 22:35:00 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-05-19 22:35:00 +0000 |
commit | da1b9f9f885f1d617fdc7f06432b3ea1d2c18408 (patch) | |
tree | 7e2934cfab220969d3c196be6973b115649f0100 /sys/nfsclient/nfs_vfsops.c | |
parent | 14c9edb63d501a8776cfe7bc273586b59b597e54 (diff) | |
download | FreeBSD-src-da1b9f9f885f1d617fdc7f06432b3ea1d2c18408.zip FreeBSD-src-da1b9f9f885f1d617fdc7f06432b3ea1d2c18408.tar.gz |
Deal with the possibility of negative available space from the file server
to avoid Bad Things(TM) happening (eg: df crashing with a floating point
exception).
Submitted by: Harold Gutch <logix@foobar.franken.de>
Approved by: re (scottl)
Diffstat (limited to 'sys/nfsclient/nfs_vfsops.c')
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 8764b2b..ec93345 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -277,15 +277,18 @@ nfs_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) for (bsize = NFS_FABLKSIZE; ; bsize *= 2) { sbp->f_bsize = bsize; tquad = fxdr_hyper(&sfp->sf_tbytes); - if ((tquad / bsize) > LONG_MAX) + if (((long)(tquad / bsize) > LONG_MAX) || + ((long)(tquad / bsize) < LONG_MIN)) continue; sbp->f_blocks = tquad / bsize; tquad = fxdr_hyper(&sfp->sf_fbytes); - if ((tquad / bsize) > LONG_MAX) + if (((long)(tquad / bsize) > LONG_MAX) || + ((long)(tquad / bsize) < LONG_MIN)) continue; sbp->f_bfree = tquad / bsize; tquad = fxdr_hyper(&sfp->sf_abytes); - if ((tquad / bsize) > LONG_MAX) + if (((long)(tquad / bsize) > LONG_MAX) || + ((long)(tquad / bsize) < LONG_MIN)) continue; sbp->f_bavail = tquad / bsize; sbp->f_files = (fxdr_unsigned(int32_t, |