Re: [PATCH v4 2/3] rust: miscdevice: add additional data to MiscDeviceRegistration
From: Christian Schrefl
Date: Sat Jun 07 2025 - 11:39:48 EST
On 07.06.25 5:37 PM, Benno Lossin wrote:
> On Sat Jun 7, 2025 at 1:34 PM CEST, Christian Schrefl wrote:
>> Yeah I understand that its not UB, but to me it seems a bit fragile and opaque why it is allowed.
>> That's what I meant by "a bit iffy".
>
> What's fragile about it? That someone could add a non-opaque field to
> the struct? Or that one is not allowed to take an `&`?
Yeah that a added field could cause UB seems bad to me.
>
>> Alright but I doubt that realistic, since the `Data` would always at
>> least be shared between the owner of `MiscDeviceRegistration` and the
>> `fops` implementation. Meaning its always shared with syscall context
>> and I don't think it makes sense to have a registration owed in
>> that context.
>
> That might be the case, but I think we should have this as a general
> design guideline: avoid unnecessary trait bounds.
Alright seems fine to me.
Cheers
Christian