lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9POL1CR89RN.2OOMXJAOR4XAK@nvidia.com>
Date: Wed, 07 May 2025 14:32:10 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Alexandre Courbot" <acourbot@...dia.com>, "Alice Ryhl"
 <aliceryhl@...gle.com>, "Danilo Krummrich" <dakr@...nel.org>
Cc: "Matthew Maurer" <mmaurer@...gle.com>, <rust-for-linux@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 6/7] rust: alloc: add Vec::remove

On Wed May 7, 2025 at 2:30 PM JST, Alexandre Courbot wrote:
> Hi Alice,
>
> On Fri May 2, 2025 at 10:19 PM JST, Alice Ryhl wrote:
>> This is needed by Rust Binder in the range allocator, and by upcoming
>> GPU drivers during firmware initialization.
>>
>> Panics in the kernel are best avoided when possible, so an error is
>> returned if the index is out of bounds. An error type is used rather
>> than just returning Option<T> to let callers handle errors with ?.
>>
>> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
>> ---
>>  rust/kernel/alloc/kvec.rs        | 42 +++++++++++++++++++++++++++++++++++++++-
>>  rust/kernel/alloc/kvec/errors.rs | 15 ++++++++++++++
>>  2 files changed, 56 insertions(+), 1 deletion(-)
>>
>> diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs
>> index 3298b3b0f32c70f3fe517fcb7af6b9922fea926b..8845e7694334b672476ff935580f3a9eb94d23fe 100644
>> --- a/rust/kernel/alloc/kvec.rs
>> +++ b/rust/kernel/alloc/kvec.rs
>> @@ -22,7 +22,7 @@
>>  };
>>  
>>  mod errors;
>> -pub use self::errors::PushError;
>> +pub use self::errors::{PushError, RemoveError};
>>  
>>  /// Create a [`KVec`] containing the arguments.
>>  ///
>> @@ -389,6 +389,46 @@ pub fn pop(&mut self) -> Option<T> {
>>          Some(unsafe { removed.read() })
>>      }
>>  
>> +    /// Removes the element at the given index.
>> +    ///
>> +    /// # Panics
>> +    ///
>> +    /// Panics if the index is out of bounds.
>
> According to the commit log (and the code of the method) I think this
> panic section is not valid anymore?

Oops never mind, I didn't notice Danilo already pointed this out. >_<

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ