소스 검색

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 년 전
부모
커밋
4e08a215c8
1개의 변경된 파일2개의 추가작업 그리고 9개의 파일을 삭제
  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`)