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: <20241004115006.4876eed1@kernel.org>
Date: Fri, 4 Oct 2024 11:50:06 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>
Cc: <andrew@...n.ch>, <hkallweit1@...il.com>, <linux@...linux.org.uk>,
 <davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
 <ramon.nordin.rodriguez@...roamp.se>, <netdev@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
 <Thorsten.Kummermehr@...rochip.com>
Subject: Re: [PATCH net-next v3 2/7] net: phy: microchip_t1s: update new
 initial settings for LAN865X Rev.B0

On Tue, 1 Oct 2024 18:07:29 +0530 Parthiban Veerasooran wrote:
> +	cfg_results[0] = FIELD_PREP(GENMASK(15, 10), (9 + offsets[0]) & 0x3F) |
> +			 FIELD_PREP(GENMASK(15, 4), (14 + offsets[0]) & 0x3F) |
> +			 0x03;
> +	cfg_results[1] = FIELD_PREP(GENMASK(15, 10), (40 + offsets[1]) & 0x3F);

It's really strange to OR together FIELD_PREP()s with overlapping
fields. What's going on here? 15:10 and 15:4 ranges overlap, then
there is 0x3 hardcoded, with no fields size definition.
Could you clarify and preferably name as many of the constants 
as possible?

Also why are you masking the result of the sum with 0x3f?
Can the result not fit? Is that safe or should we error out?

> +		ret &= GENMASK(4, 0);
? 		if (ret & BIT(4))

GENMASK() is nice but naming the fields would be even nicer..
What's 3:0, what's 4:4 ?
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ