mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
hypervisor: x86: add two safety comments
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
6c89c541da
commit
7f2723d9c6
@ -272,6 +272,7 @@ impl LapicState {
|
|||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
// SAFETY: plain old data type
|
||||||
let sliceu8 = unsafe {
|
let sliceu8 = unsafe {
|
||||||
// This array is only accessed as parts of a u32 word, so interpret it as a u8 array.
|
// This array is only accessed as parts of a u32 word, so interpret it as a u8 array.
|
||||||
// Cursors are only readable on arrays of u8, not i8(c_char).
|
// Cursors are only readable on arrays of u8, not i8(c_char).
|
||||||
@ -290,6 +291,7 @@ impl LapicState {
|
|||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
// SAFETY: plain old data type
|
||||||
let sliceu8 = unsafe {
|
let sliceu8 = unsafe {
|
||||||
// This array is only accessed as parts of a u32 word, so interpret it as a u8 array.
|
// This array is only accessed as parts of a u32 word, so interpret it as a u8 array.
|
||||||
// Cursors are only readable on arrays of u8, not i8(c_char).
|
// Cursors are only readable on arrays of u8, not i8(c_char).
|
||||||
|
Loading…
Reference in New Issue
Block a user