Re: [PATCH v2] rust: opp: simplify callers of `to_c_str_array`

From: Tamir Duberstein

Date: Wed Oct 29 2025 - 10:26:26 EST


On Wed, Oct 29, 2025 at 10:24 AM Tamir Duberstein <tamird@xxxxxxxxxx> wrote:
>
> On Thu, Oct 23, 2025 at 11:23 AM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
> >
> > On 23-10-25, 09:59, Tamir Duberstein wrote:
> > > Use `Option` combinators to make this a bit less noisy.
> > >
> > > Wrap the `dev_pm_opp_set_config` operation in a closure and use type
> > > ascription to leverage the compiler to check for use after free.
> > >
> > > Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxxx>
> > > ---
> > > Note: this diff is much smaller with whitespace suppressed (`-w`).
> > >
> > > An alternative approach to compiler checking for UAF that doesn't change
> > > indentation is to add `drop((self, clk_names, regulator_names))` after
> > > `let ret = ...;` but that felt more prone to becoming out of date if
> > > more owned data needed to be added to the function scope.
> > > ---
> > > Changes in v2:
> > > - Avoid use after free; add compiler checking. (Thanks Viresh!)
> > > - Link to v1: https://patch.msgid.link/20251020-opp-simpler-code-v1-1-04f7f447712f@xxxxxxxxxx
> > > ---
> > > rust/kernel/opp.rs | 112 +++++++++++++++++++++++++++--------------------------
> > > 1 file changed, 58 insertions(+), 54 deletions(-)
> >
> > Thanks, tested this and it works.
> >
> > Lets see if someone has any more inputs, otherwise I can apply it.
>
> Thanks for testing! Doesn't look like anyone has opinions. Good to go?

Ah I see you've already applied it. Thanks!