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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANiq72=8iokcwv8zG81oxi9_+8p3_X2s8dRgrXi9DGjaSaDDMg@mail.gmail.com>
Date: Fri, 11 Apr 2025 19:05:07 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Viresh Kumar <viresh.kumar@...aro.org>, "Rafael J. Wysocki" <rafael@...nel.org>, 
	Danilo Krummrich <dakr@...hat.com>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, 
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>, 
	Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, 
	Danilo Krummrich <dakr@...nel.org>, linux-pm@...r.kernel.org, 
	Vincent Guittot <vincent.guittot@...aro.org>, Stephen Boyd <sboyd@...nel.org>, 
	Nishanth Menon <nm@...com>, rust-for-linux@...r.kernel.org, 
	Manos Pitsidianakis <manos.pitsidianakis@...aro.org>, Erik Schilling <erik.schilling@...aro.org>, 
	Alex Bennée <alex.bennee@...aro.org>, 
	Joakim Bech <joakim.bech@...aro.org>, Rob Herring <robh@...nel.org>, Burak Emir <bqe@...gle.com>, 
	Rasmus Villemoes <linux@...musvillemoes.dk>, Russell King <linux@...linux.org.uk>, 
	linux-clk@...r.kernel.org, Michael Turquette <mturquette@...libre.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V9 08/17] cpufreq: Use enum for cpufreq flags that use BIT()

On Fri, Apr 11, 2025 at 6:07 PM Yury Norov <yury.norov@...il.com> wrote:
>
> The BIT() is as simple as '1 << nr'. How that it's so complex for that
> tool to realize that '1 << 2' is the constant?

It is a C macro which requires evaluating a C expression as the C
compiler would.

A solution (a workaround, really) in `bindgen` is coming, that
essentially forces `libclang` to evaluate it for us, but even if it
works perfectly fine already, it will require upgrading the minimum
version and so on, so it will take time.

For the moment, either we do something like this (a similar approach
was used for some `enum`s in Binder) or the values can be replicated
on the Rust side (ideally with a test somewhere to ensure they are in
sync). The latter may be best if the values have not changed much over
time, i.e. if there is low maintenance required.

I hope that helps.

Cheers,
Miguel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ