Skip to content

Commit

Permalink
gdt: Fix off-by-one error in from_raw_slice()
Browse files Browse the repository at this point in the history
We use our poor-man's assert instead of trying to do math.

Signed-off-by: Joe Richey <joerichey@google.com>
  • Loading branch information
josephlr committed Jul 7, 2021
1 parent 66b11eb commit f1dc0ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/structures/gdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit f1dc0ff

Please sign in to comment.