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: <a8c29dec-6178-4f8f-80f5-aece636c410b@kernel.org>
Date: Thu, 27 Feb 2025 07:38:58 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Kuan-Wei Chiu <visitorckw@...il.com>, tglx@...utronix.de,
 mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
 jk@...abs.org, joel@....id.au, eajames@...ux.ibm.com,
 andrzej.hajda@...el.com, neil.armstrong@...aro.org, rfoss@...nel.org,
 maarten.lankhorst@...ux.intel.com, mripard@...nel.org, tzimmermann@...e.de,
 airlied@...il.com, simona@...ll.ch, dmitry.torokhov@...il.com,
 mchehab@...nel.org, awalls@...metrocast.net, hverkuil@...all.nl,
 miquel.raynal@...tlin.com, richard@....at, vigneshr@...com,
 louis.peens@...igine.com, andrew+netdev@...n.ch, davem@...emloft.net,
 edumazet@...gle.com, pabeni@...hat.com, parthiban.veerasooran@...rochip.com,
 arend.vanspriel@...adcom.com, johannes@...solutions.net,
 gregkh@...uxfoundation.org, akpm@...ux-foundation.org, hpa@...or.com,
 alistair@...ple.id.au, linux@...musvillemoes.dk,
 Laurent.pinchart@...asonboard.com, jonas@...boo.se,
 jernej.skrabec@...il.com, kuba@...nel.org, linux-kernel@...r.kernel.org,
 linux-fsi@...ts.ozlabs.org, dri-devel@...ts.freedesktop.org,
 linux-input@...r.kernel.org, linux-media@...r.kernel.org,
 linux-mtd@...ts.infradead.org, oss-drivers@...igine.com,
 netdev@...r.kernel.org, linux-wireless@...r.kernel.org,
 brcm80211@...ts.linux.dev, brcm80211-dev-list.pdl@...adcom.com,
 linux-serial@...r.kernel.org, bpf@...r.kernel.org, jserv@...s.ncku.edu.tw,
 Yu-Chun Lin <eleanor15x@...il.com>
Subject: Re: [PATCH 02/17] bitops: Add generic parity calculation for u64

On 26. 02. 25, 19:33, Yury Norov wrote:
>> Not in cases where macros are inevitable. I mean, do we need parityXX() for
>> XX in (8, 16, 32, 64) at all? Isn't the parity() above enough for everybody?
> 
> The existing codebase has something like:
> 
>          int ret;
> 
>          ret = i3c_master_get_free_addr(m, last_addr + 1);
>          ret |= parity8(ret) ? 0 : BIT(7)
> 
> So if we'll switch it to a macro like one above, it will become a
> 32-bit parity. It wouldn't be an error because i3c_master_get_free_addr()
> returns an u8 or -ENOMEM, and the error code is checked explicitly.
> 
> But if we decide to go with parity() only, some users will have to
> call it like parity((u8)val) explicitly. Which is not bad actually.

That cast looks ugly -- we apparently need parityXX(). (In this 
particular case we could do parity8(last_addr), but I assume there are 
more cases like this.) Thanks for looking up the case for this.

>> And if not, you can have all those parityXX() as inlines as you suggest, but
>> also provide a macro such as the above to call (optimized) parityXX() as per
>> datatype len.
> 
> Yes, if we need fixed-type parity's, they should all be one-liners
> calling the same macro. Macros or inline functions - no preference for
> me.

-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ