From 02da1fd4f3b78908aa906e5219a6d5ebdbf39b0a Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Sat, 5 May 2018 13:50:04 +0000 Subject: [PATCH] Fix for GPT partitions scan. GPT partition entry array (GPEA) has 128 entries by default, unused ones must be zeroed. Due to memory corruption GPEA contained non-zero data of first sectors of partitions. This led to fake partitions detected which were mostly filtered out by their start:length and thus didn't show up. Pass ebx=three-sector-sized buffer to disk_add_partition as expected. git-svn-id: svn://kolibrios.org@7270 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/blkdev/disk.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/trunk/blkdev/disk.inc b/kernel/trunk/blkdev/disk.inc index a538b8d635..0bd560986b 100644 --- a/kernel/trunk/blkdev/disk.inc +++ b/kernel/trunk/blkdev/disk.inc @@ -960,11 +960,10 @@ endl pop eax jnz .fail_free_gpea_gpt ; Compute and check CRC32 of GPEA - mov edx, [ebx+GPTH.PartitionEntryArrayCRC32] mov eax, -1 stdcall crc_32, 0xEDB88320, edi, [GPEA_len] xor eax, -1 - cmp eax, edx + cmp eax, [ebx+GPTH.PartitionEntryArrayCRC32] jnz .fail_free_gpea_gpt ; Process partitions, skip zeroed ones. @@ -982,8 +981,11 @@ endl sbb edx, dword[edi+GPE.StartingLBA+4] add eax, 1 adc edx, 0 + push ebx + mov ebx, [ebp-8] ; three-sectors-sized buffer stdcall disk_add_partition, dword[edi+GPE.StartingLBA+0], \ dword[edi+GPE.StartingLBA+4], eax, edx, esi + pop ebx add edi, [ebx+GPTH.SizeOfPartitionEntry] .skip: dec [ebx+GPTH.NumberOfPartitionEntries]