From: Arnd Bergmann <arnd@arndb.de>
To: Brian Norris <computersforpeace@gmail.com>
Cc: linux-mtd@lists.infradead.org,
"Dmitry Torokhov" <dtor@google.com>,
"Anatol Pomazao" <anatol@google.com>,
"Ray Jui" <rjui@broadcom.com>,
"Corneliu Doban" <cdoban@broadcom.com>,
"Jonathan Richardson" <jonathar@broadcom.com>,
"Scott Branden" <sbranden@broadcom.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Rafał Miłecki" <zajec5@gmail.com>,
bcm-kernel-feedback-list@broadcom.com,
"Dan Ehrenberg" <dehrenberg@chromium.org>,
"Gregory Fong" <gregory.0xf0@gmail.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
"Kevin Cernekee" <cernekee@gmail.com>
Subject: Re: [PATCH v4 08/11] mtd: brcmnand: add BCM63138 support
Date: Wed, 13 May 2015 22:48:19 +0200 [thread overview]
Message-ID: <2173063.OarFjbCqhk@wuerfel> (raw)
In-Reply-To: <20150513202415.GI11598@ld-irv-0074>
On Wednesday 13 May 2015 13:24:15 Brian Norris wrote:
> > >
> > > static int bcm63138_nand_probe(...)
> > > {
> > > struct bcm63138_nand_soc *priv;
> > >
> > > priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > > ...
> > > return brcmnand_probe(pdev, &priv->soc);
> > > }
> >
> > That would make struct brcmnand_soc an empty structure, right?
>
> No, it still contains the function pointers for our callbacks, which is
> the entire point. I guess it's more of a 'nand_soc_ops' structure than a
> 'nand_soc' pointer now though.
>
Ah, I see.
This is fine for a small number of function pointers, but if you ever
get a structure like this with a lot of pointers, it's better to
keep them separate, so you can define the structure of function pointers
as 'static const' in the client driver, as we do for a number of
other operations.
The main advantage of that is that you don't have to assign the members
manually at run-time, but also putting them into the read-only segment
makes it harder for an attacker to overwrite a known function pointer
with a pointer to an exploit (assuming they have limited control over
writing to kernel memory).
Arnd
next prev parent reply other threads:[~2015-05-13 20:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 0:53 [PATCH v4 00/11] mtd: nand: add Broadcom NAND controller support Brian Norris
2015-05-13 0:53 ` [PATCH v4 01/11] Documentation: devicetree: add binding doc for Broadcom NAND controller Brian Norris
2015-05-13 0:53 ` [PATCH v4 02/11] mtd: nand: add NAND driver "library" for Broadcom STB " Brian Norris
2015-05-13 0:53 ` [PATCH v4 03/11] mtd: brcmnand: add support for STB chips Brian Norris
2015-05-13 0:53 ` [PATCH v4 04/11] ARM: bcm7445: add NAND to DTS Brian Norris
2015-05-13 0:53 ` [PATCH v4 06/11] mtd: brcmnand: add extra SoC support to library Brian Norris
2015-05-13 0:53 ` [PATCH v4 07/11] mtd: brcmnand: add support for Broadcom's IPROC family Brian Norris
[not found] ` <1431478424-29230-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-13 0:53 ` [PATCH v4 05/11] Documentation: devicetree: brcmstb_nand: add BCM63138 and Cygnus/iProc Brian Norris
2015-05-13 0:53 ` [PATCH v4 08/11] mtd: brcmnand: add BCM63138 support Brian Norris
[not found] ` <1431478424-29230-9-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-13 10:49 ` Arnd Bergmann
2015-05-13 19:45 ` Brian Norris
2015-05-13 20:02 ` Arnd Bergmann
2015-05-13 20:24 ` Brian Norris
2015-05-13 20:48 ` Arnd Bergmann [this message]
2015-05-13 0:53 ` [PATCH v4 10/11] ARM: dts: cygnus: Enable NAND support for Cygnus Brian Norris
2015-05-13 0:53 ` [PATCH v4 11/11] MAINTAINERS: add entry for new brcmnand/ directory Brian Norris
2015-05-13 17:56 ` [PATCH v4 00/11] mtd: nand: add Broadcom NAND controller support Florian Fainelli
[not found] ` <5553903B.9030605-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-13 18:14 ` Brian Norris
2015-05-13 19:08 ` Arnd Bergmann
2015-05-13 0:53 ` [PATCH v4 09/11] ARM: bcm63138: add NAND DT support Brian Norris
2015-05-13 10:39 ` [PATCH v4 00/11] mtd: nand: add Broadcom NAND controller support Arnd Bergmann
2015-05-15 20:23 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2173063.OarFjbCqhk@wuerfel \
--to=arnd@arndb.de \
--cc=anatol@google.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cdoban@broadcom.com \
--cc=cernekee@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=dehrenberg@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=dtor@google.com \
--cc=f.fainelli@gmail.com \
--cc=gregory.0xf0@gmail.com \
--cc=jonathar@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).