From 4b5dbc15df9205a5276c46c3563387cda5504a7b Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 15 May 2021 17:15:10 +0200 Subject: [PATCH] Kernel: Fix incorrect argument when constructing DiskPartitionMetadata The existing code invokes operator bool for the partition_type variable. --- Kernel/Storage/Partition/EBRPartitionTable.cpp | 4 +--- Kernel/Storage/Partition/MBRPartitionTable.cpp | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Kernel/Storage/Partition/EBRPartitionTable.cpp b/Kernel/Storage/Partition/EBRPartitionTable.cpp index e43f4fe0474..2cf0c2735f8 100644 --- a/Kernel/Storage/Partition/EBRPartitionTable.cpp +++ b/Kernel/Storage/Partition/EBRPartitionTable.cpp @@ -64,9 +64,7 @@ EBRPartitionTable::EBRPartitionTable(const StorageDevice& device) if (entry.offset == 0x00) { continue; } - auto partition_type = ByteBuffer::create_zeroed(sizeof(u8)); - partition_type.data()[0] = entry.type; - m_partitions.append(DiskPartitionMetadata({ entry.offset, (entry.offset + entry.length), partition_type })); + m_partitions.empend(entry.offset, (entry.offset + entry.length), entry.type); } } diff --git a/Kernel/Storage/Partition/MBRPartitionTable.cpp b/Kernel/Storage/Partition/MBRPartitionTable.cpp index f071e6ab9bd..8443792b364 100644 --- a/Kernel/Storage/Partition/MBRPartitionTable.cpp +++ b/Kernel/Storage/Partition/MBRPartitionTable.cpp @@ -60,9 +60,7 @@ MBRPartitionTable::MBRPartitionTable(const StorageDevice& device, u32 start_lba) if (entry.offset == 0x00) { continue; } - auto partition_type = ByteBuffer::create_zeroed(sizeof(u8)); - partition_type.data()[0] = entry.type; - m_partitions.append(DiskPartitionMetadata({ entry.offset, (entry.offset + entry.length), partition_type })); + m_partitions.empend(entry.offset, (entry.offset + entry.length), entry.type); } m_valid = true; } @@ -81,9 +79,7 @@ MBRPartitionTable::MBRPartitionTable(const StorageDevice& device) if (entry.offset == 0x00) { continue; } - auto partition_type = ByteBuffer::create_zeroed(sizeof(u8)); - partition_type.data()[0] = entry.type; - m_partitions.append(DiskPartitionMetadata({ entry.offset, (entry.offset + entry.length), partition_type })); + m_partitions.empend(entry.offset, (entry.offset + entry.length), entry.type); } m_valid = true; }