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: <aThETSRch_okmCbe@smile.fi.intel.com>
Date: Tue, 9 Dec 2025 17:46:21 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: david.laight.linux@...il.com
Cc: Yury Norov <yury.norov@...il.com>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Alexandre Belloni <alexandre.belloni@...tlin.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Crt Mori <cmo@...exis.com>,
	Richard Genoud <richard.genoud@...tlin.com>,
	Luo Jie <quic_luoj@...cinc.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
	"David S . Miller" <davem@...emloft.net>,
	Simon Horman <simon.horman@...ronome.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	Andreas Noever <andreas.noever@...il.com>,
	Yehezkel Bernat <YehezkelShB@...il.com>,
	Nicolas Frattaroli <nicolas.frattaroli@...labora.com>
Subject: Re: [PATCH 3/9] bitmap: Use FIELD_PREP() in expansion of
 FIELD_PREP_WM16()

On Tue, Dec 09, 2025 at 10:03:07AM +0000, david.laight.linux@...il.com wrote:

> Instead of directly expanding __BF_FIELD_CHECK() (which really ought
> not be used outside bitfield) and open-coding the generation of the
> masked value, just call FIELD_PREP() and add an extra check for
> the mask being at most 16 bits.

...

> +#define FIELD_PREP_WM16(mask, val)				\
> +({								\
> +	__auto_type _mask = mask;				\
> +	u32 _val = FIELD_PREP(_mask, val);			\

> +	BUILD_BUG_ON_MSG(_mask > 0xffffu,			\
> +			 "FIELD_PREP_WM16: mask too large");	\

Can it be static_assert() instead?

> +	_val | (_mask << 16);					\
> +})

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ