From 502016815daa0a87aa9cbb4d4fec89bfd1142fe0 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 15 Mar 2024 10:53:45 +0100 Subject: [PATCH] Avoid unaligned access in the XsdtIter The pointers in the XSDT table are only 4 byte aligned. --- src/acpi/xsdt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acpi/xsdt.rs b/src/acpi/xsdt.rs index dd6736a050..5c7de4ce68 100644 --- a/src/acpi/xsdt.rs +++ b/src/acpi/xsdt.rs @@ -37,7 +37,7 @@ impl Iterator for XsdtIter { type Item = usize; fn next(&mut self) -> Option { if self.i < self.sdt.data_len() / mem::size_of::() { - 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 {