Skip to content

Commit d4b4cff

Browse files
committed
fixup! *RFL import: kernel::io_buffer
Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 3e8a61a commit d4b4cff

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rust/kernel/io_buffer.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
//! Buffers used in IO.
66
7+
use crate::alloc::{flags::*, vec_ext::VecExt};
78
use crate::error::Result;
89
use alloc::vec::Vec;
910
use core::mem::{size_of, MaybeUninit};
@@ -31,8 +32,11 @@ pub trait IoBufferReader {
3132
///
3233
/// Returns `EFAULT` if the address does not currently point to mapped, readable memory.
3334
fn read_all(&mut self) -> Result<Vec<u8>> {
34-
let mut data = Vec::<u8>::new();
35-
data.try_resize(self.len(), 0)?;
35+
let mut data = Vec::<u8>::with_capacity(self.len(), GFP_KERNEL)?;
36+
// FIXME? data.resize(self.len(), 0);
37+
for _ in 0..self.len() {
38+
data.push(0, GFP_KERNEL)?
39+
}
3640

3741
// SAFETY: The output buffer is valid as we just allocated it.
3842
unsafe { self.read_raw(data.as_mut_ptr(), data.len())? };

0 commit comments

Comments
 (0)