svn commit: r304142 - head/usr.sbin/bsdinstall/partedit

Dag-Erling Smørgrav des at des.no
Wed Aug 17 15:41:27 UTC 2016


Hans Petter Selasky <hps at selasky.org> writes:
> My intention is not to install FreeBSD on a 3K disk. My question is
> pure mathematical, if the bsdinstall will segfault, division by zero
> or anything like that, if one should try to install FreeBSD on a 3K
> disk, because you round up the size of the disk to be bigger than it
> actually is.

The code in question computes the offset and size of the largest block
of contiguous free space on a disk that already has a partition table.
If you even got this far, it would round the offset up to 4096 and the
size down by and equivalent amount and you'd get an error box saying "No
free space left on device".

Say you have a 3584-byte provider with 512-byte sectors formatted with
MBR, leaving 3072 bytes (6 sectors) free at offset 512 (1); stripe size
is unreported and is arbitrarily set to the smallest common multiple of
512 and 4096, which is 4096; misalignment is 512 % 4096 == 512 bytes;
adjustment is (4096 - 512) / 512 == 7 sectors; adjusted offset is 8
sectors, adjusted size is -1 sectors which the caller rejects (and yes,
the variables are unsigned and the check is for <= 0, not == 0, so
everything works as intended).

DES
-- 
Dag-Erling Smørgrav - des at des.no


More information about the svn-src-head mailing list