authorgravatar for truemedian@gmail.comNameless <truemedian@gmail.com> 2024-09-19 18:03:33-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-24 13:30:53-07:00
log8d76c02f9a7ca664ee669e1f9c1a70b841eb2774
tree5af8c3ec7f09b30bf3334835fdc6055230092942
parent37cd21eb5f23d2bb26e36ca3de76f0a71e16230c

uefi: erroneous alignment check in pool_allocator

Fixes #21446 Both UefiPoolAllocator and UefiRawPoolAllocator were passing the value of `log2_ptr_align` directly to `mem.alignAllocLen` which expects a alignment value. Both of these calls to `mem.alignAllocLen` are pointless and the result of the alignment both always true, and was thrown away anyway. I have removed these calls entirely.

1 files changed, 1 insertions(+), 6 deletions(-)

lib/std/os/uefi/pool_allocator.zig+1-6
...@@ -48,11 +48,9 @@ const UefiPoolAllocator = struct {...@@ -48,11 +48,9 @@ const UefiPoolAllocator = struct {
48 ret_addr: usize,48 ret_addr: usize,
49 ) bool {49 ) bool {
50 _ = ret_addr;50 _ = ret_addr;
51 _ = log2_old_ptr_align;
5152
52 if (new_len > buf.len) return false;53 if (new_len > buf.len) return false;
53
54 _ = mem.alignAllocLen(buf.len, new_len, log2_old_ptr_align);
55
56 return true;54 return true;
57 }55 }
5856
...@@ -121,9 +119,6 @@ fn uefi_resize(...@@ -121,9 +119,6 @@ fn uefi_resize(
121 std.debug.assert(log2_old_ptr_align <= 3);119 std.debug.assert(log2_old_ptr_align <= 3);
122120
123 if (new_len > buf.len) return false;121 if (new_len > buf.len) return false;
124
125 _ = mem.alignAllocLen(buf.len, new_len, 8);
126
127 return true;122 return true;
128}123}
129124