From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from quartz.orcorp.ca ([184.70.90.242]:57283 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310Ab2LGXEr (ORCPT ); Fri, 7 Dec 2012 18:04:47 -0500 Date: Fri, 7 Dec 2012 15:44:46 -0700 From: Jason Gunthorpe To: linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Wim Van Sebroeck Subject: [PATCH] ARM: Orion: Fix possible null-deference in orion_wdt_probe Message-ID: <20121207224446.GA29262@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-watchdog-owner@vger.kernel.org List-Id: linux-watchdog@vger.kernel.org If the DT does not include a regs parameter then the null res would be dereferenced. Signed-off-by: Jason Gunthorpe --- drivers/watchdog/orion_wdt.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index c20f96b..140a1e3 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c @@ -156,6 +156,8 @@ static int __devinit orion_wdt_probe(struct platform_device *pdev) wdt_tclk = clk_get_rate(clk); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; wdt_reg = devm_ioremap(&pdev->dev, res->start, resource_size(res)); if (!wdt_reg) return -ENOMEM; -- 1.7.5.4