summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2000-01-28 10:22:07 +0000
committerbde <bde@FreeBSD.org>2000-01-28 10:22:07 +0000
commitdff980d98b9f7bee87ebee9c2273ede358e115e0 (patch)
treed333b8a29578a8b49f6a5a37eb31ff979617ebe4 /sys/i386
parentd32ad2b60dbf440447d99a5234e49155e1090162 (diff)
downloadFreeBSD-src-dff980d98b9f7bee87ebee9c2273ede358e115e0.zip
FreeBSD-src-dff980d98b9f7bee87ebee9c2273ede358e115e0.tar.gz
Don't permit generation of non-physical disk addresses.
subr_diskmbr.c: Don't "helpfully" enlarge our idea of the disk size to cover all the primary slices. Instead, truncate or discard slices that don't seem to be on the disk. The enlargement was a hack for disks that don't report their size (e.g., MFM disks). It is just wrong in general. wd.c: In CHS mode, limit the disk size so that cylinder numbers >= 65536 cannot occur. This normally only affects disks larger than 33.8GB. CHS mode accesses to addresses above the limit are now properly broken (an error is returned instead of garbage for reads and disk corruption for writes). PR: 15611 Reviewed by: readers of freebsd-bugs did not respond to a request for review
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/isa/wd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 3069366..66ae5fc 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -1760,6 +1760,14 @@ failed:
du->dk_dd.d_ncylinders =
du->dk_dd.d_secperunit / du->dk_dd.d_secpercyl;
}
+ if (du->dk_dd.d_ncylinders > 0x10000 && !(du->cfg_flags & WDOPT_LBA)) {
+ du->dk_dd.d_ncylinders = 0x10000;
+ du->dk_dd.d_secperunit = du->dk_dd.d_secpercyl *
+ du->dk_dd.d_ncylinders;
+ printf(
+ "wd%d: cannot handle %d total sectors; truncating to %lu\n",
+ du->dk_lunit, wp->wdp_lbasize, du->dk_dd.d_secperunit);
+ }
#if 0
du->dk_dd.d_partitions[RAW_PART].p_size = du->dk_dd.d_secperunit;
/* dubious ... */
OpenPOWER on IntegriCloud