Merge branch 'fix-repr-packed' into 'master'

Fix possible UB by implementing Copy and Clone manually for BuddyEntry.

See merge request redox-os/rmm!1
This commit is contained in:
Jeremy Soller
2020-12-20 16:08:31 +00:00
+13 -1
View File
@@ -16,7 +16,6 @@ use crate::{
#[repr(transparent)]
struct BuddyUsage(u8);
#[derive(Clone, Copy)]
#[repr(packed)]
struct BuddyEntry<A> {
base: PhysicalAddress,
@@ -28,6 +27,19 @@ struct BuddyEntry<A> {
phantom: PhantomData<A>,
}
impl<A> Clone for BuddyEntry<A> {
fn clone(&self) -> Self {
Self {
base: self.base,
size: self.size,
skip: self.skip,
used: self.used,
phantom: PhantomData,
}
}
}
impl<A> Copy for BuddyEntry<A> {}
impl<A: Arch> BuddyEntry<A> {
fn empty() -> Self {
Self {