Skip to content

Commit 1d40fb2

Browse files
committed
Add Safety comment to FrameAllocator
This fixes a clippy warning Signed-off-by: Joe Richey <[email protected]>
1 parent 9c340c5 commit 1d40fb2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/structures/paging/frame_alloc.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ use crate::structures::paging::{PageSize, PhysFrame};
44

55
/// A trait for types that can allocate a frame of memory.
66
///
7-
/// This trait is unsafe to implement because the implementer must guarantee that
8-
/// the `allocate_frame` method returns only unique unused frames.
7+
/// # Safety
8+
///
9+
/// The implementer of this trait must guarantee that the `allocate_frame`
10+
/// method returns only unique unused frames. Otherwise, undefined behavior
11+
/// may result from two caller modifying or deallocating the same frame.
912
pub unsafe trait FrameAllocator<S: PageSize> {
1013
/// Allocate a frame of the appropriate size and return it if possible.
1114
fn allocate_frame(&mut self) -> Option<PhysFrame<S>>;

0 commit comments

Comments
 (0)