All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: ie6xx_wdt: Check for null res pointer
@ 2021-12-20  6:17 Jiasheng Jiang
  0 siblings, 0 replies; only message in thread
From: Jiasheng Jiang @ 2021-12-20  6:17 UTC (permalink / raw)
  To: wim, linux; +Cc: linux-watchdog, linux-kernel, Jiasheng Jiang

The return value of platform_get_resource() needs to be checked.
To avoid use of error pointer in case of the failure of alloc.

Fixes: 101ce87b3bdd ("watchdog: Add watchdog driver for Intel Atom E6XX")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/watchdog/ie6xx_wdt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c
index 8f28993fab8b..ee5b68d2e271 100644
--- a/drivers/watchdog/ie6xx_wdt.c
+++ b/drivers/watchdog/ie6xx_wdt.c
@@ -271,6 +271,9 @@ static int ie6xx_wdt_remove(struct platform_device *pdev)
 	struct resource *res;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+	if (!res)
+		return -EINVAL;
+
 	ie6xx_wdt_stop(NULL);
 	watchdog_unregister_device(&ie6xx_wdt_dev);
 	ie6xx_wdt_debugfs_exit();
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-20  6:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20  6:17 [PATCH] watchdog: ie6xx_wdt: Check for null res pointer Jiasheng Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.