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: <20260203063910.GB2323039@ragnatech.se>
Date: Tue, 3 Feb 2026 07:39:10 +0100
From: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
	Geert Uytterhoeven <geert+renesas@...der.be>,
	Magnus Damm <magnus.damm@...il.com>,
	Richard Cochran <richardcochran@...il.com>, netdev@...r.kernel.org,
	linux-renesas-soc@...r.kernel.org
Subject: Re: [net-next 4/4] net: ethernet: renesas: rcar_gen4_ptp: Hide
 private data from users

Hello Jakub,

Thanks for your feedback.

On 2026-02-02 19:11:21 -0800, Jakub Kicinski wrote:
> On Sun,  1 Feb 2026 19:37:45 +0100 Niklas Söderlund wrote:
> > The Gen4 PTP helper module is already used by RTSN and RSWITCH to
> > support PTP clocks and will be used by RAVB too. Hide the Gen4 PTP
> > private data structure to make sure none of the users poke at it.
> > 
> > This will be more important for RAVB use-cases as more then one RAVB
> > device will need to cooperate using one PTP clock source.
> 
> IMO hiding type definitions in C is an anti-pattern.
> Sooner or later you'll need a sizeof or a static inline helper 
> and you'll have to bend over backwards to access the type info.
> 
> We can take this if you have a strong preference, but please
> think again if you really need this or it's a code cleanliness
> instinct carried over from objective programming, hence foreign..

On principle I agree with you, hiding type definitions is usually not a 
good idea long term, but here I would still like to do it.

My reason is that the goal is to completely remove the type from the 
header file and only expose the struct ptp_clock to users.

The private data will need to be reworked as the next device where 
support for the Gen4 PTP clock need to support the same PTP clock device 
to be used by multiple network devices. This will make the private data 
more fragile and I don't want to expose that to the users as the helpers 
will then be mandatory to use.

I'm sure there are multiple paths to achieve my goal, but unless you 
strongly object against this intermediate step I would like to move 
forward with it.

-- 
Kind Regards,
Niklas Söderlund

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ