kernel: Use memcpy() when cloning UserVM
All checks were successful
continuous-integration/drone/push Build is passing

This way, any future fields in VMRegion get copied automatically.
This commit is contained in:
apio 2023-06-18 01:54:29 +02:00
parent 67ed18629d
commit 3a3473b9c2
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -49,13 +49,9 @@ Result<OwnedPtr<UserVM>> UserVM::clone()
for (const auto* region : m_regions)
{
auto* copied_region = TRY(make<VMRegion>());
copied_region->start = region->start;
copied_region->end = region->end;
copied_region->count = region->count;
copied_region->used = region->used;
copied_region->persistent = region->persistent;
ptr->m_regions.append(copied_region);
auto* new_region = TRY(make<VMRegion>());
memcpy(new_region, region, sizeof(*region));
ptr->m_regions.append(new_region);
}
return move(ptr);