summaryrefslogtreecommitdiff
path: root/sys/kern/subr_diskslice.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2002-06-06 00:35:07 +0000
committerBruce Evans <bde@FreeBSD.org>2002-06-06 00:35:07 +0000
commit6438c894da90fe46c8a2886d8be6c11b8d0225b3 (patch)
tree27457c04f8a31c9b3fcffb85c1ae4f9122df8276 /sys/kern/subr_diskslice.c
parent50e7d6539c0c2df00004a6c325c6e499f31ee86b (diff)
Notes
Diffstat (limited to 'sys/kern/subr_diskslice.c')
-rw-r--r--sys/kern/subr_diskslice.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c
index 9259bf8124fc..a52e301a9736 100644
--- a/sys/kern/subr_diskslice.c
+++ b/sys/kern/subr_diskslice.c
@@ -56,6 +56,7 @@
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/stat.h>
+#include <sys/stdint.h>
#include <sys/syslog.h>
#include <sys/vnode.h>
@@ -224,19 +225,18 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()");
#endif
/* beyond partition? */
- if (secno + nsec > endsecno) {
+ if ((uintmax_t)secno + nsec > endsecno) {
/* if exactly at end of disk, return an EOF */
if (secno == endsecno) {
bp->bio_resid = bp->bio_bcount;
return (0);
}
/* or truncate if part of it fits */
- nsec = endsecno - secno;
- if (nsec <= 0) {
+ if (secno > endsecno) {
bp->bio_error = EINVAL;
goto bad;
}
- bp->bio_bcount = nsec * ssp->dss_secsize;
+ bp->bio_bcount = (endsecno - secno) * ssp->dss_secsize;
}
bp->bio_pblkno = sp->ds_offset + slicerel_secno;