From f1dc0ff027c602a0f9127f4183a77518bd2877bc Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Tue, 22 Jun 2021 02:24:21 -0700 Subject: [PATCH] gdt: Fix off-by-one error in from_raw_slice() We use our poor-man's assert instead of trying to do math. Signed-off-by: Joe Richey --- src/structures/gdt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/structures/gdt.rs b/src/structures/gdt.rs index 02007fb71..f71a8c11c 100644 --- a/src/structures/gdt.rs +++ b/src/structures/gdt.rs @@ -123,7 +123,7 @@ impl GlobalDescriptorTable { "initializing a GDT from a slice requires it to be **at most** 8 elements." ); #[cfg(not(feature = "const_fn"))] - table[next_free]; // Will fail if slice.len() > 8 + [(); 1][!(next_free <= 8) as usize]; while idx != next_free { table[idx] = slice[idx];