Re: [PATCH v3 06/13] rust: hrtimer: add `UnsafeTimerPointer`
From: Andreas Hindborg
Date: Wed Nov 20 2024 - 11:56:17 EST
"Lyude Paul" <lyude@xxxxxxxxxx> writes:
> On Thu, 2024-10-17 at 15:04 +0200, Andreas Hindborg wrote:
>> Add a trait to allow unsafely queuing stack allocated timers.
>>
>> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
>> ---
>> rust/kernel/hrtimer.rs | 33 +++++++++++++++++++++++++++++++++
>> 1 file changed, 33 insertions(+)
>>
>> diff --git a/rust/kernel/hrtimer.rs b/rust/kernel/hrtimer.rs
>> index eeed2afd501b64b94d57cc658616659e28785078..e97d7b8ec63ce6c9ac3fe9522192a28fba78b8ba 100644
>> --- a/rust/kernel/hrtimer.rs
>> +++ b/rust/kernel/hrtimer.rs
>> @@ -151,6 +151,39 @@ pub trait TimerPointer: Sync + Sized {
>> fn start(self, expires: Ktime) -> Self::TimerHandle;
>> }
>>
>> +/// Unsafe version of [`TimerPointer`] for situations where leaking the
>> +/// `TimerHandle` returned by `start` would be unsound. This is the case for
>> +/// stack allocated timers.
>> +///
>> +/// Typical implementers are pinned references such as [`Pin<&T>].
>
> Missing a `
Thanks! I wonder why this is not caught when building the docs.
Best regards,
Andreas Hindborg