aboutsummaryrefslogtreecommitdiff
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
committerBrooks Davis <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
commit86e0bd0dc01df04903b9f79b919246e3ba2688e2 (patch)
tree55a26b557d8150629d66818990d4e3cb31253ad4 /sbin/bsdlabel/bsdlabel.c
parent030c6fb15639d9a62fbcfab76c18368ebf7a0541 (diff)
downloadsrc-86e0bd0dc01df04903b9f79b919246e3ba2688e2.tar.gz
src-86e0bd0dc01df04903b9f79b919246e3ba2688e2.zip
The disk labels generated by bsdlabel can no address more than
0xffffffff sectors. Document this limit and avoid installing bogus labels on disks with more sectors. Allowing the installation of labels addressing as much of the disk as possiable may be a useful addition in some situations, but this was easy to implement and should reduce confusion. PR: bin/71408
Notes
Notes: svn path=/head/; revision=134973
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index cef20506fd22..8d44e6878df0 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -477,6 +477,9 @@ readlabel(int flag)
(ioctl(f, DIOCGSECTORSIZE, &secsize) != 0)) {
err(4, "cannot get disk geometry");
}
+ if (mediasize > (off_t)0xffffffff * secsize)
+ errx(1,
+ "disks with more than 2^32-1 sectors are not supported");
(void)lseek(f, (off_t)0, SEEK_SET);
if (read(f, bootarea, BBSIZE) != BBSIZE)
err(4, "%s read", specname);