summaryrefslogtreecommitdiffstats
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
committerbrooks <brooks@FreeBSD.org>2004-09-09 07:46:53 +0000
commit0073b704f8c46292e24e9b722a439777146f8915 (patch)
tree55a26b557d8150629d66818990d4e3cb31253ad4 /sbin/bsdlabel/bsdlabel.c
parentd4e6ebd0c9b531af4b69bb69db16d4d14936e0e2 (diff)
downloadFreeBSD-src-0073b704f8c46292e24e9b722a439777146f8915.zip
FreeBSD-src-0073b704f8c46292e24e9b722a439777146f8915.tar.gz
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
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 cef2050..8d44e68 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);
OpenPOWER on IntegriCloud