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>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2023 05:29:39 -0800
From:   Haoran Liu <liuhaoran14@....com>
To:     claudiu.beznea@...on.dev
Cc:     sre@...nel.org, nicolas.ferre@...rochip.com,
        alexandre.belloni@...tlin.com, linux-pm@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Haoran Liu <liuhaoran14@....com>
Subject: [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe

This patch adds error handling to the at91_shdwc_probe function
in drivers/power/reset/at91-sama5d2_shdwc.c. The function
previously did not handle the case where of_match_node could fail,
potentially leading to unexpected behavior if the device tree match
was unsuccessful.

Signed-off-by: Haoran Liu <liuhaoran14@....com>
---
 drivers/power/reset/at91-sama5d2_shdwc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
index e76b102b57b1..2ac566c83aec 100644
--- a/drivers/power/reset/at91-sama5d2_shdwc.c
+++ b/drivers/power/reset/at91-sama5d2_shdwc.c
@@ -353,6 +353,11 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
 		return PTR_ERR(at91_shdwc->shdwc_base);
 
 	match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node);
+	if (!match) {
+		dev_err(&pdev->dev, "No matching device found\n");
+		return -ENODEV;
+	}
+
 	at91_shdwc->rcfg = match->data;
 
 	at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ