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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <849f8571-84d8-fc6a-c064-d6c649129081@gmail.com>
Date:   Fri, 19 Apr 2019 08:26:37 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     David Miller <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net-next 06/15] dsa: Remove const from tag driver ops
 structure



On 4/18/2019 2:47 PM, Andrew Lunn wrote:
> On Thu, Apr 18, 2019 at 10:58:46AM -0700, Florian Fainelli wrote:
>>
>>
>> On 4/17/2019 7:31 PM, Andrew Lunn wrote:
>>> A later patch will create a linked list of tag driver ops structures,
>>> using a list_head in the structure. So the structure cannot be const.
>>
>> Can't we encapsulate the existing dsa_device_ops, while leaving them
>> const into another structure which is not const? Similar to how we did
>> with the dsa_switch_driver structure?
> 
> Hi Florian
> 
> I was trying to keep it KISS, no dynamic memory allocation.
> 
> But i can make it more complex. For a tag driver with a single set of
> ops, i can probably hide it all in the boiler plate, and make it all
> static memory. For tag_brcm.c and tag_ksz.c, which have two ops
> structures, i'm not sure i can hide it all.

I don't think you need dynamic allocation, since you already have a
dsa_device_ops structure within each of the tagger source file, you can
just encapsulate that within the context of the file:

struct dsa_tag_driver {
	const char *name;
	const struct dsa_device_ops *ops;
}

Or something along those lines?
-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ