From 5bc696a85a53e1e9cc0c4d0ea205101fbde986da Mon Sep 17 00:00:00 2001 From: Shaowei Song Date: Thu, 29 Aug 2024 03:01:42 +0000 Subject: [PATCH] Make the allocated segment uninitialized in the ring buffer --- kernel/src/util/ring_buffer.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/src/util/ring_buffer.rs b/kernel/src/util/ring_buffer.rs index 01d78352e..e3df106c5 100644 --- a/kernel/src/util/ring_buffer.rs +++ b/kernel/src/util/ring_buffer.rs @@ -77,7 +77,10 @@ impl RingBuffer { "capacity must be a power of two" ); let nframes = capacity.saturating_mul(Self::T_SIZE).align_up(PAGE_SIZE) / PAGE_SIZE; - let segment = FrameAllocOptions::new(nframes).alloc_contiguous().unwrap(); + let segment = FrameAllocOptions::new(nframes) + .uninit(true) + .alloc_contiguous() + .unwrap(); Self { segment, capacity,