Skip to content

Commit f1dc0ff

Browse files
committed
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 <[email protected]>
1 parent 66b11eb commit f1dc0ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/structures/gdt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl GlobalDescriptorTable {
123123
"initializing a GDT from a slice requires it to be **at most** 8 elements."
124124
);
125125
#[cfg(not(feature = "const_fn"))]
126-
table[next_free]; // Will fail if slice.len() > 8
126+
[(); 1][!(next_free <= 8) as usize];
127127

128128
while idx != next_free {
129129
table[idx] = slice[idx];

0 commit comments

Comments
 (0)