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: <20181224164738.17973-1-pakki001@umn.edu>
Date:   Mon, 24 Dec 2018 10:47:37 -0600
From:   Aditya Pakki <pakki001@....edu>
To:     pakki001@....edu
Cc:     kjlu@....edu, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Jan Kiszka <jan.kiszka@...mens.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] x86/intel-mid: Add pr_warn when platform_device_add() fails

platform_device_add() may fail in intel_scu_devices_create and
sfi_handle_ipc_dev. The fix checks for the return value in these cases
and displays the failed device.

Signed-off-by: Aditya Pakki <pakki001@....edu>
---
 arch/x86/platform/intel-mid/sfi.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 7be1e1fe9ae3..e69511bafec5 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -278,9 +278,13 @@ static void __init intel_scu_i2c_device_register(int bus,
 void intel_scu_devices_create(void)
 {
 	int i;
+	int ret;
 
-	for (i = 0; i < ipc_next_dev; i++)
-		platform_device_add(ipc_devs[i]);
+	for (i = 0; i < ipc_next_dev; i++) {
+		ret = platform_device_add(ipc_devs[i]);
+		if (ret)
+			pr_warn("can't add device %s\n", ipc_devs[i]);
+	}
 
 	for (i = 0; i < spi_next_dev; i++)
 		spi_register_board_info(spi_devs[i], 1);
@@ -330,6 +334,7 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
 {
 	struct platform_device *pdev;
 	void *pdata = NULL;
+	int ret;
 
 	pr_debug("IPC bus, name = %16.16s, irq = 0x%2x\n",
 		pentry->name, pentry->irq);
@@ -360,8 +365,11 @@ static void __init sfi_handle_ipc_dev(struct sfi_device_table_entry *pentry,
 	pdev->dev.platform_data = pdata;
 	if (dev->delay)
 		intel_scu_ipc_device_register(pdev);
-	else
-		platform_device_add(pdev);
+	else {
+		ret = platform_device_add(pdev);
+		if (ret)
+			pr_warn("can't add device %s\n", pdev);
+	}
 }
 
 static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ