summaryrefslogtreecommitdiffstats
path: root/lib/libdisk
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-11-03 06:24:48 +0000
committermarcel <marcel@FreeBSD.org>2003-11-03 06:24:48 +0000
commit2464f65e4a4b7cbb0f19cd1bbdddf66f184ae59b (patch)
tree1501e3833c8ddd8157f34e94ce12a23992e4d857 /lib/libdisk
parent112f2c38060e509779b15374f516b20a821743f5 (diff)
downloadFreeBSD-src-2464f65e4a4b7cbb0f19cd1bbdddf66f184ae59b.zip
FreeBSD-src-2464f65e4a4b7cbb0f19cd1bbdddf66f184ae59b.tar.gz
Fix two bugs in the calculation of the last LBA of the GPT covered
part of the disk. The first appears to be a typo and instead of dividing the media size with the sector size, we multiplied. The second is an off-by-1 error that's the result of mixing up count and index. The code in question is only applicable for virgin disks and is used to create the "whole" chunk, which covers only the GPT usable portion of the disk.
Diffstat (limited to 'lib/libdisk')
-rw-r--r--lib/libdisk/open_ia64_disk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libdisk/open_ia64_disk.c b/lib/libdisk/open_ia64_disk.c
index 019bf36..476185d 100644
--- a/lib/libdisk/open_ia64_disk.c
+++ b/lib/libdisk/open_ia64_disk.c
@@ -125,8 +125,8 @@ parse_disk(char *conftxt, const char *name)
disk->gpt_size = 128;
disk->lba_start = (disk->gpt_size * sizeof(struct gpt_ent)) /
disk->sector_size + 2;
- disk->lba_end = (disk->media_size * disk->sector_size) -
- disk->lba_start + 1;
+ disk->lba_end = (disk->media_size / disk->sector_size) -
+ disk->lba_start;
} else {
disk->lba_start = gpt->hdr_lba_start;
disk->lba_end = gpt->hdr_lba_end;
OpenPOWER on IntegriCloud