Avoid unaligned access in the XsdtIter

The pointers in the XSDT table are only 4 byte aligned.
This commit is contained in:
bjorn3
2024-03-15 10:53:45 +01:00
parent d5e1188b8e
commit 502016815d
+1 -1
View File
@@ -37,7 +37,7 @@ impl Iterator for XsdtIter {
type Item = usize;
fn next(&mut self) -> Option<Self::Item> {
if self.i < self.sdt.data_len() / mem::size_of::<u64>() {
let item = unsafe { *(self.sdt.data_address() as *const u64).add(self.i) };
let item = unsafe { core::ptr::read_unaligned((self.sdt.data_address() as *const u64).add(self.i)) };
self.i += 1;
Some(item as usize)
} else {