The 9 bytes immediately prior to the partition table can contain

signatures or disk serial numbers. Don't assume those to be zero
in all cases. This fixes a false negative.

Tested by: avatar@mmlab.cse.yzu.edu.tw
This commit is contained in:
Marcel Moolenaar 2009-04-03 05:54:49 +00:00
parent bd8536f83a
commit daca55549f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190667

View File

@ -403,9 +403,14 @@ g_part_ebr_probe(struct g_part_table *table, struct g_consumer *cp)
if (magic != DOSMAGIC)
goto out;
/* The sector is all zeroes, except for the partition entries. */
/*
* The sector is all zeroes, except for the partition entries
* and some signatures or disk serial number. Those can be
* found in the 9 bytes immediately in front of the partition
* table.
*/
sum = 0;
for (index = 0; index < DOSPARTOFF; index++)
for (index = 0; index < DOSPARTOFF - 9; index++)
sum += buf[index];
if (sum != 0)
goto out;