aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/part/g_part_bsd.c
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2008-10-25 17:21:46 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2008-10-25 17:21:46 +0000
commit38a2db2eb00626b9c868c2fd6d6510860a0f20c7 (patch)
tree4af0fdefaf7ddc2656aa684ad4d6a341b7eca2fa /sys/geom/part/g_part_bsd.c
parentbee8d4f213e6c63efc321c0f942d4d7fe6900a1c (diff)
downloadsrc-38a2db2eb00626b9c868c2fd6d6510860a0f20c7.tar.gz
src-38a2db2eb00626b9c868c2fd6d6510860a0f20c7.zip
Invalid BSD disklabels have been created by sysinstall and
are possibly still being created. The d_secperunit field contains the number of sectors of the disk and not of the slice/partition to which the disklabel applies. Rather than reject the disklabel, we now silently adjust the field. Existing code, like bslabel(8), does not seem to check the label that extensively and seems to adjust fields as a side-effect as well. In other words, it's not that important apparently, so gpart should not be too strict about it. Reported by: nyan@ Reported by: Andriy Gapon <avg@icyb.net.ua>
Notes
Notes: svn path=/head/; revision=184264
Diffstat (limited to 'sys/geom/part/g_part_bsd.c')
-rw-r--r--sys/geom/part/g_part_bsd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/geom/part/g_part_bsd.c b/sys/geom/part/g_part_bsd.c
index f7213e32b21b..e87c5a3922de 100644
--- a/sys/geom/part/g_part_bsd.c
+++ b/sys/geom/part/g_part_bsd.c
@@ -341,8 +341,13 @@ g_part_bsd_read(struct g_part_table *basetable, struct g_consumer *cp)
printf("GEOM: %s: geometry does not match label.\n", pp->name);
chs = le32dec(buf + 60);
- if (chs < 1 || chs > msize)
+ if (chs < 1)
goto invalid_label;
+ /* Fix-up a sysinstall bug. */
+ if (chs > msize) {
+ chs = msize;
+ le32enc(buf + 60, msize);
+ }
if (chs != msize)
printf("GEOM: %s: media size does not match label.\n",
pp->name);