Skip to content

Commit f497aae

Browse files
Hsiu Che YuDanilo Krummrich
authored andcommitted
rust: alloc: fix Vec::extend_with SAFETY comment
Fix an incorrect operator in the SAFETY comment, changing `<` to `<=`, since `Vec::reserve` guarantees capacity for exactly n additional elements, so the equal case should be included. Signed-off-by: Hsiu Che Yu <yu.whisper.personal@gmail.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Fixes: 2aac4cd ("rust: alloc: implement kernel `Vec` type") Link: https://patch.msgid.link/18fc8eee2f057a6bfbcadae156d1d0b7c40d0077.1777111268.git.yu.whisper.personal@gmail.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
1 parent 802ca00 commit f497aae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎rust/kernel/alloc/kvec.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
884884
spare[n - 1].write(value);
885885

886886
// SAFETY:
887-
// - `self.len() + n < self.capacity()` due to the call to reserve above,
887+
// - `self.len() + n <= self.capacity()` due to the call to reserve above,
888888
// - the loop and the line above initialized the next `n` elements.
889889
unsafe { self.inc_len(n) };
890890

0 commit comments

Comments
 (0)