Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Suman Anna <s-anna@ti.com>
To: Greg Kroah-Hartman <greg@linuxfoundation.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>, Paul Walmsley <paul@pwsan.com>,
	linux-omap@vger.kernel.org, Russell King <linux@arm.linux.org.uk>,
	Benoit Cousson <b-cousson@ti.com>, Arnd Bergmann <arnd@arndb.de>,
	Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>,
	Tony Lindgren <tony@atomide.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Suman Anna <s-anna@ti.com>,
	linux-kernel@vger.kernel.org,
	Felipe Contreras <felipe.contreras@nokia.com>,
	Dom Cobley <popcornmix@gmail.com>,
	Wim Van Sebroeck <wim@iguana.be>,
	Fernando Guzman Lugo <lugo.fernando@gmail.com>,
	Omar Ramirez Luna <omar.ramirez@copitl.com>,
	Tejun Heo <tj@kernel.org>,
	Omar Ramirez Luna <omar.luna@linaro.org>,
	Loic Pallardy <loic.pallardy@st.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/13] mailbox/omap: check iomem resource before dereferencing it
Date: Mon, 11 Feb 2013 22:57:10 -0600	[thread overview]
Message-ID: <1360645032-9668-12-git-send-email-s-anna@ti.com> (raw)
In-Reply-To: <1360645032-9668-1-git-send-email-s-anna@ti.com>

Add a NULL check for iomem resource in mailbox probe functions.

Signed-off-by: Fernando Guzman Lugo <lugo.fernando@gmail.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
---
 drivers/mailbox/mailbox-omap1.c | 3 +++
 drivers/mailbox/mailbox-omap2.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/mailbox/mailbox-omap1.c b/drivers/mailbox/mailbox-omap1.c
index 295c32a..5b0f2c1 100644
--- a/drivers/mailbox/mailbox-omap1.c
+++ b/drivers/mailbox/mailbox-omap1.c
@@ -179,6 +179,9 @@ static int omap1_mbox_probe(struct platform_device *pdev)
 	list[0]->irq = platform_get_irq_byname(pdev, "dsp");
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem)
+		return -ENOMEM;
+
 	mbox_base = ioremap(mem->start, resource_size(mem));
 	if (!mbox_base)
 		return -ENOMEM;
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index d3a3d84..9fbd491 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -293,6 +293,11 @@ static int omap2_mbox_probe(struct platform_device *pdev)
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem) {
+		ret = -ENOMEM;
+		goto free;
+	}
+
 	mbox_base = ioremap(mem->start, resource_size(mem));
 	if (!mbox_base) {
 		ret = -ENOMEM;
-- 
1.8.1.2

  parent reply	other threads:[~2013-02-12  4:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  4:56 [PATCH v2 00/13] drivers: mailbox: framework creation Suman Anna
2013-02-12  4:57 ` [PATCH v2 01/13] ARM: OMAP2+: mbox: remove dependencies with soc.h Suman Anna
2013-02-12  4:57 ` [PATCH v2 02/13] mailbox: OMAP: introduce mailbox framework Suman Anna
2013-02-12  4:57 ` [PATCH v2 03/13] mailbox: split internal header from API header Suman Anna
2013-02-12  4:57 ` [PATCH v2 04/13] mailbox: rename omap_mbox in mailbox Suman Anna
2013-02-12  4:57 ` [PATCH v2 05/13] mailbox: create opened message type Suman Anna
2013-02-12  4:57 ` [PATCH v2 06/13] mailbox: change protection mechanisms Suman Anna
2013-02-12  4:57 ` [PATCH v2 07/13] mailbox: add shared memory mailbox type Suman Anna
2013-02-12  4:57 ` [PATCH v2 08/13] mailbox: add IRQF_NO_SUSPEND flag Suman Anna
2013-02-12  4:57 ` [PATCH v2 09/13] mailbox: add no_irq send message Suman Anna
2013-02-12  4:57 ` [PATCH v2 10/13] mailbox: create dbx500 mailbox driver Suman Anna
2013-02-12 10:39   ` Mark Rutland
2013-02-12 20:01     ` Loic PALLARDY
2013-02-13  9:08       ` Mark Rutland
2013-02-12  4:57 ` Suman Anna [this message]
2013-02-12  4:57 ` [PATCH v2 12/13] mailbox: check for NULL nb in mailbox_put Suman Anna
2013-02-12  4:57 ` [PATCH v2 13/13] mailbox: call request_irq after mbox queues are allocated Suman Anna
2013-02-13 13:36 ` [PATCH v2 00/13] drivers: mailbox: framework creation Linus Walleij
2013-02-13 13:42   ` Russell King - ARM Linux
2013-02-13 16:41     ` Anna, Suman
2013-02-13 20:36       ` Loic PALLARDY

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=1360645032-9668-12-git-send-email-s-anna@ti.com \
    --to=s-anna@ti.com \
    --cc=arnd@arndb.de \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=felipe.contreras@nokia.com \
    --cc=greg@linuxfoundation.org \
    --cc=jkrzyszt@tis.icnet.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=loic.pallardy@st.com \
    --cc=lugo.fernando@gmail.com \
    --cc=ohad@wizery.com \
    --cc=omar.luna@linaro.org \
    --cc=omar.ramirez@copitl.com \
    --cc=paul@pwsan.com \
    --cc=popcornmix@gmail.com \
    --cc=tj@kernel.org \
    --cc=tony@atomide.com \
    --cc=wim@iguana.be \
    /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