Subject: Re: [PATCH net 1/2] net: dsa: bcm_sf2: Do not clobber b53_switch_ops

From: Andrew Lunn <[email-masked]>
Date: Sun, 8 Jan 2017 18:41:05 +0100

On Sat, Jan 07, 2017 at 09:01:56PM -0800, Florian Fainelli wrote:
> We make the bcm_sf2 driver override ds->ops which points to
> b53_switch_ops since b53_switch_alloc() did the assignent. This is all
> well and good until a second b53 switch comes in, and ends up using the
> bcm_sf2 operations. Make a proper local copy, substitute the ds->ops
> pointer and then override the operations.
> 
> Fixes: f458995b9ad8 ("net: dsa: bcm_sf2: Utilize core B53 driver when possible")
> Signed-off-by: Florian Fainelli <[email-masked]>

Hi Florian

There is a general trend of making ops structures const. It closes off
kernel exploits. This coping and then modifying prevents us making
ds->ops a pointer to a const.

You are already using b53_common.c as a library. Could you go further
with the concept, and export the ops you need for SF2, and have SF2
define its own ops structure? We can then swap to const ops dsa wide.

Thanks
	Andrew