lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1456007007-11200-1-git-send-email-colin.king@canonical.com>
Date:	Sat, 20 Feb 2016 22:23:27 +0000
From:	Colin King <colin.king@...onical.com>
To:	Zhang Rui <rui.zhang@...el.com>,
	Eduardo Valentin <edubezval@...il.com>,
	linux-pm@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] thermal: rcar: check for NULL return of of_match_device

From: Colin Ian King <colin.king@...onical.com>

of_match_device can potentially return NULL, so we need to check for
this case to avoid a null pointer dereference on of_id

Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
 drivers/thermal/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 0e735ac..5943881 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -431,13 +431,17 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct resource *res, *irq;
 	const struct of_device_id *of_id = of_match_device(rcar_thermal_dt_ids, dev);
-	unsigned long of_data = (unsigned long)of_id->data;
+	unsigned long of_data;
 	int mres = 0;
 	int i;
 	int ret = -ENODEV;
 	int idle = IDLE_INTERVAL;
 	u32 enr_bits = 0;
 
+	if (!of_id)
+		return ret;
+	of_data = (unsigned long)of_id->data;
+
 	common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
 	if (!common)
 		return -ENOMEM;
-- 
2.7.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ