Skip to content

Commit d4d1b8c

Browse files
authored
Update part_driver_mbr.c to check for valid MBR
1 parent 1c6f598 commit d4d1b8c

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

iop/fs/bdm/src/part_driver_mbr.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,8 @@ int part_connect_mbr(struct block_device *bd)
9292

9393
//Most likely a VBR
9494
if(valid_partitions == 0) {
95-
96-
if ((partIndex = GetNextFreePartitionIndex()) == -1)
97-
{
98-
// No more free partition slots.
99-
printf("Can't mount partition, no more free partition slots!\n");
100-
return -1;
101-
}
102-
103-
// Create the pseudo block device for the partition.
104-
g_part[partIndex].bd = bd;
105-
g_part_bd[partIndex].name = bd->name;
106-
g_part_bd[partIndex].devNr = bd->devNr;
107-
g_part_bd[partIndex].parNr = 1;
108-
g_part_bd[partIndex].parId = 0; //Can be any type of (ex)FATxx, is parsed later.
109-
g_part_bd[partIndex].sectorSize = bd->sectorSize;
110-
g_part_bd[partIndex].sectorOffset = bd->sectorOffset;
111-
g_part_bd[partIndex].sectorCount = bd->sectorCount;
112-
bdm_connect_bd(&g_part_bd[partIndex]);
113-
11495
FreeSysMemory(pMbrBlock);
115-
return 0;
96+
return -1;
11697
}
11798

11899
for (int i = 0; i < 4; i++)
@@ -133,6 +114,7 @@ int part_connect_mbr(struct block_device *bd)
133114
{
134115
// No more free partition slots.
135116
printf("Can't mount partition, no more free partition slots!\n");
117+
FreeSysMemory(pMbrBlock);
136118
continue;
137119
}
138120

0 commit comments

Comments
 (0)