Date: Sun, 24 Aug 2014 09:20:31 +0000 (UTC) From: "Andrey V. Elsukov" <ae@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270445 - head/sys/boot/common Message-ID: <201408240920.s7O9KVen089882@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ae Date: Sun Aug 24 09:20:30 2014 New Revision: 270445 URL: http://svnweb.freebsd.org/changeset/base/270445 Log: The size of the GPT table can not be less than one sector. Reported by: rodrigc@ MFC after: 1 week Modified: head/sys/boot/common/part.c Modified: head/sys/boot/common/part.c ============================================================================== --- head/sys/boot/common/part.c Sun Aug 24 09:04:09 2014 (r270444) +++ head/sys/boot/common/part.c Sun Aug 24 09:20:30 2014 (r270445) @@ -254,8 +254,8 @@ ptable_gptread(struct ptable *table, voi table->sectorsize); if (phdr != NULL) { /* Read the primary GPT table. */ - size = MIN(MAXTBLSZ, - phdr->hdr_entries * phdr->hdr_entsz / table->sectorsize); + size = MIN(MAXTBLSZ, (phdr->hdr_entries * phdr->hdr_entsz + + table->sectorsize - 1) / table->sectorsize); if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && gpt_checktbl(phdr, tbl, size * table->sectorsize, table->sectors - 1) == 0) { @@ -287,8 +287,9 @@ ptable_gptread(struct ptable *table, voi hdr.hdr_entsz != phdr->hdr_entsz || hdr.hdr_crc_table != phdr->hdr_crc_table) { /* Read the backup GPT table. */ - size = MIN(MAXTBLSZ, phdr->hdr_entries * - phdr->hdr_entsz / table->sectorsize); + size = MIN(MAXTBLSZ, (phdr->hdr_entries * + phdr->hdr_entsz + table->sectorsize - 1) / + table->sectorsize); if (dread(dev, tbl, size, phdr->hdr_lba_table) == 0 && gpt_checktbl(phdr, tbl, size * table->sectorsize, table->sectors - 1) == 0) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408240920.s7O9KVen089882>