Skip to contentSkip to conversation

ARM: Orion: Fix possible null-deference in orion_wdt_probe

PATCH New Jason Gunthorpe 1 participant 1 message Dec 7, 2012 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Orion: Fix possible null-deference in orion_wdt_probe

If the DT does not include a regs parameter then the null res would be dereferenced.

---
 drivers/watchdog/orion_wdt.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/watchdog/orion_wdt.c +2 -0
index c20f96b..140a1e3 100644
@@ -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;
Signature · 1 line
1.7.5.4