Re: [PATCH v4 17/27] rust: pci: make Bar lifetime-parameterized
From: Danilo Krummrich
Date: Mon May 25 2026 - 08:06:01 EST
On Mon May 25, 2026 at 1:40 PM CEST, Gary Guo wrote:
> On Mon May 25, 2026 at 5:37 AM BST, Eliot Courtney wrote:
>> On Fri May 22, 2026 at 8:34 AM JST, Danilo Krummrich wrote:
>>> +impl<'a, const SIZE: usize> Bar<'a, SIZE> {
>>> + pub(super) fn new(pdev: &'a Device<device::Bound>, num: u32, name: &CStr) -> Result<Self> {
>>
>> I think Sashiko's comment w.r.t. &CStrs in this patch looks accurate
>> and they should be 'static or at least 'a ish.
>
> It needs to be `'static` to be leak-safe.
Yes, it needs to be 'static as it is stored directly in struct resource. This
has been a bug without this patch already; I will insert a small fix for this,
so it can be picked by stable separately.
Thanks,
Danilo