Răsfoiți Sursa

acpi: fix length of "extended_area_bytes" in RSDP search

Since the memory mapping is already including "RSDP_V2_EXT_LENGTH"
bytes to allow for an ACPI 1.0 table at the end of the region,
it the slice should just use the actual region length
instead of going beyond it...
Alex Olson 2 ani în urmă
părinte
comite
4e08a215c8
1 a modificat fișierele cu 2 adăugiri și 9 ștergeri
  1. 2 9
      rsdp/src/lib.rs

+ 2 - 9
rsdp/src/lib.rs

@@ -91,15 +91,8 @@ impl Rsdp {
                 handler.map_physical_region::<u8>(area.start, area.end - area.start + RSDP_V2_EXT_LENGTH)
             };
 
-            // SAFETY: The entirety of `mapping` maps the search area and an additional `RSDP_V2_EXT_LENGTH` bytes
-            // that are assumed to be safe to read while `extended_area_bytes` lives. (Ideally, an assumption about
-            // the memory following the search area would not be made.)
-            let extended_area_bytes = unsafe {
-                slice::from_raw_parts(
-                    mapping.virtual_start().as_ptr(),
-                    mapping.region_length() + RSDP_V2_EXT_LENGTH,
-                )
-            };
+            let extended_area_bytes =
+                unsafe { slice::from_raw_parts(mapping.virtual_start().as_ptr(), mapping.region_length()) };
 
             // Search `Rsdp`-sized windows at 16-byte boundaries relative to the base of the area (which is also
             // aligned to 16 bytes due to the implementation of `find_search_areas`)