rust: alloc: Fix `ArrayLayout` allocations
Changes
1 files changed · +1 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| rust/kernel/alloc/layout.rs | modified | +1 | −1 | View file |
rust/kernel/alloc/layout.rs
View filediff --git a/rust/kernel/alloc/layout.rs b/rust/kernel/alloc/layout.rs
index 7e0c2f4..4b3cd7f 100644
--- a/rust/kernel/alloc/layout.rs
+++ b/rust/kernel/alloc/layout.rs
@@ -45,7 +45,7 @@ impl<T> ArrayLayout<T> {
/// When `len * size_of::<T>()` overflows or when `len * size_of::<T>() > isize::MAX`.
pub const fn new(len: usize) -> Result<Self, LayoutError> {
match len.checked_mul(core::mem::size_of::<T>()) {
- Some(len) if len <= ISIZE_MAX => {
+ Some(size) if size <= ISIZE_MAX => {
// INVARIANT: We checked above that `len * size_of::<T>() <= isize::MAX`.
Ok(Self {
len,