From ca02a69fdfb556cb9c8c6d75a29d71b600cbe3c6 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 16 Nov 2022 21:42:29 +0000 Subject: [PATCH] qcow: add a safety comment Signed-off-by: Wei Liu --- qcow/src/raw_file.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/qcow/src/raw_file.rs b/qcow/src/raw_file.rs index 886f0481f..620bad182 100644 --- a/qcow/src/raw_file.rs +++ b/qcow/src/raw_file.rs @@ -231,6 +231,7 @@ impl Write for RawFile { return Err(io::Error::last_os_error()); } + // SAFETY: tmp_ptr is at least rounded_len long let tmp_buf = unsafe { slice::from_raw_parts_mut(tmp_ptr, rounded_len) }; // This can eventually replaced with read_at once its interface