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]
Date:   Tue, 12 May 2020 08:04:39 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     David Miller <davem@...emloft.net>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        John Crispin <john@...ozen.org>,
        Sean Wang <sean.wang@...iatek.com>,
        Mark Lee <Mark-MC.Lee@...iatek.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Fabien Parent <fparent@...libre.com>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Edwin Peer <edwin.peer@...adcom.com>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-mediatek@...ts.infradead.org,
        Stephane Le Provost <stephane.leprovost@...iatek.com>,
        Pedro Tsai <pedro.tsai@...iatek.com>,
        Andrew Perepech <andrew.perepech@...iatek.com>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v2 05/14] net: core: provide priv_to_netdev()

pon., 11 maj 2020 o 22:41 David Miller <davem@...emloft.net> napisaƂ(a):
>
> From: Bartosz Golaszewski <brgl@...ev.pl>
> Date: Mon, 11 May 2020 17:07:50 +0200
>
> > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> >
> > Appropriate amount of extra memory for private data is allocated at
> > the end of struct net_device. We have a helper - netdev_priv() - that
> > returns its address but we don't have the reverse: a function which
> > given the address of the private data, returns the address of struct
> > net_device.
> >
> > This has caused many drivers to store the pointer to net_device in
> > the private data structure, which basically means storing the pointer
> > to a structure in this very structure.
> >
> > This patch proposes to add priv_to_netdev() - a helper which converts
> > the address of the private data to the address of the associated
> > net_device.
> >
> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
>
> Sorry, please don't do this.  We had this almost two decades ago and
> explicitly removed it intentionally.
>
> Store the back pointer in your software state just like everyone else
> does.

I will if you insist but would you mind sharing some details on why it
was removed? To me it still makes more sense than storing the pointer
to a structure in *that* structure.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ