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] [day] [month] [year] [list]
Message-ID: <6fe2aed9-f29e-4a77-5f47-855cfefe1973@inria.fr>
Date: Mon, 19 May 2025 17:39:52 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Luo Jie <quic_luoj@...cinc.com>
cc: Markus Elfring <Markus.Elfring@....de>, cocci@...ia.fr, 
    linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev, 
    Catalin Marinas <catalin.marinas@....com>, Joey Gouly <joey.gouly@....com>, 
    Julia Lawall <Julia.Lawall@...ia.fr>, Marc Zyngier <maz@...nel.org>, 
    Nicolas Palix <nicolas.palix@...g.fr>, 
    Oliver Upton <oliver.upton@...ux.dev>, 
    Rasmus Villemoes <linux@...musvillemoes.dk>, 
    Suzuki Poulouse <suzuki.poulose@....com>, Will Deacon <will@...nel.org>, 
    Yury Norov <yury.norov@...il.com>, Zenghui Yu <yuzenghui@...wei.com>, 
    LKML <linux-kernel@...r.kernel.org>, Andrew Lunn <andrew@...n.ch>, 
    "Kiran Kumar C.S.K" <quic_kkumarcs@...cinc.com>, 
    Lei Wei <quic_leiwei@...cinc.com>, Pavithra R <quic_pavir@...cinc.com>, 
    Suruchi Agarwal <quic_suruchia@...cinc.com>, quic_linchen@...cinc.com
Subject: Re: [cocci] [PATCH v3 2/6] coccinelle: misc: Add field_modify
 script



On Mon, 19 May 2025, Luo Jie wrote:

>
>
> On 4/24/2025 12:35 AM, Markus Elfring wrote:
> > …
> > > > -reg &= ~mask;
> > > > -reg |= FIELD_PREP
> > > > +       FIELD_MODIFY
> > > >                     (mask,
> > > > +                  &reg,
> > > >                      val
> > > >                     );
> > …
> > > With this code variant, there is no space prior to &reg, here is the
> > > example code changes generated by the SmPL code as below, is this
> > > expected?
> > …
> > > +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
> > > @@ -244,8 +244,7 @@ static int stf_dphy_configure(struct phy
> > >          i = stf_dphy_get_config_index(bitrate);
> > >
> > >          tmp = readl(dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100));
> > > -       tmp &= ~STF_DPHY_REFCLK_IN_SEL;
> > > -       tmp |= FIELD_PREP(STF_DPHY_REFCLK_IN_SEL, STF_DPHY_REFCLK_12M);
> > > +       FIELD_MODIFY(STF_DPHY_REFCLK_IN_SEL,&tmp, STF_DPHY_REFCLK_12M);
> > >          writel(tmp, dphy->topsys + STF_DPHY_APBIFSAIF_SYSCFG(100));
> >
> > The Coccinelle software is still evolving somehow.
> > Thus your test result can trigger further development considerations.
> > I hope that clarifications and corresponding improvements can be achieved
> > also according to such source code layout concerns.
> >
> > Regards,
> > Markus
>
> OK, understand. I will keep the original patch as below for now, as we
> need to ensure the script generates code with the expected style.
> +- reg &= ~mask;
> +- reg |= FIELD_PREP(mask, val);
> ++ FIELD_MODIFY(mask, &reg, val);
>
> In addition, below case is filed to request this improvement on the
> coccinelle project.
> https://github.com/coccinelle/coccinelle/issues/397

Thanks for the report.

julia


>
> Thanks.
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ