Skip to content

Commit 4e08a21

Browse files
A0lsonIsaacWoods
authored andcommitted
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...
1 parent 6076ae7 commit 4e08a21

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

rsdp/src/lib.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,8 @@ impl Rsdp {
9191
handler.map_physical_region::<u8>(area.start, area.end - area.start + RSDP_V2_EXT_LENGTH)
9292
};
9393

94-
// SAFETY: The entirety of `mapping` maps the search area and an additional `RSDP_V2_EXT_LENGTH` bytes
95-
// that are assumed to be safe to read while `extended_area_bytes` lives. (Ideally, an assumption about
96-
// the memory following the search area would not be made.)
97-
let extended_area_bytes = unsafe {
98-
slice::from_raw_parts(
99-
mapping.virtual_start().as_ptr(),
100-
mapping.region_length() + RSDP_V2_EXT_LENGTH,
101-
)
102-
};
94+
let extended_area_bytes =
95+
unsafe { slice::from_raw_parts(mapping.virtual_start().as_ptr(), mapping.region_length()) };
10396

10497
// Search `Rsdp`-sized windows at 16-byte boundaries relative to the base of the area (which is also
10598
// aligned to 16 bytes due to the implementation of `find_search_areas`)

0 commit comments

Comments
 (0)