Fix a critical bug: When reading block succeeds but detecting MBR fails, it should...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 16 Mar 2007 09:24:10 +0000 (09:24 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 16 Mar 2007 09:24:10 +0000 (09:24 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2483 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c

index cf790d4..d71698c 100644 (file)
@@ -162,10 +162,13 @@ Returns:
                       BlockIo->Media->BlockSize,\r
                       Mbr\r
                       );\r
                       BlockIo->Media->BlockSize,\r
                       Mbr\r
                       );\r
-  if (EFI_ERROR (Status) || !PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) {\r
+  if (EFI_ERROR (Status)) {\r
     Found = Status;\r
     goto Done;\r
   }\r
     Found = Status;\r
     goto Done;\r
   }\r
+  if (!PartitionValidMbr (Mbr, BlockIo->Media->LastBlock)) {\r
+    goto Done;\r
+  }\r
   //\r
   // We have a valid mbr - add each partition\r
   //\r
   //\r
   // We have a valid mbr - add each partition\r
   //\r