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]
Message-ID: <53A050BA.9010004@oracle.com>
Date:	Tue, 17 Jun 2014 22:29:14 +0800
From:	Jeff Liu <jeff.liu@...cle.com>
To:	stefanr@...6.in-berlin.de
CC:	linux1394-devel@...ts.sourceforge.net,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 08/24] drivers/firmware: return actual error on sysfs init

From: Jie Liu <jeff.liu@...cle.com>

This patch fix all sysfs init functions under firmware subsystems
to return the actual error if call kset_create_and_add() failed.

Cc: Stefan Richter <stefanr@...6.in-berlin.de>
Signed-off-by: Jie Liu <jeff.liu@...cle.com>
---
 drivers/firmware/dmi-sysfs.c       | 4 +++-
 drivers/firmware/edd.c             | 4 ++--
 drivers/firmware/efi/efivars.c     | 4 ++--
 drivers/firmware/efi/runtime-map.c | 4 ++--
 drivers/firmware/memmap.c          | 4 ++--
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index e0f1cb3..9e867f4 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -657,8 +657,10 @@ static int __init dmi_sysfs_init(void)
 		goto err;
 
 	dmi_kset = kset_create_and_add("entries", NULL, dmi_kobj);
-	if (!dmi_kset)
+	if (IS_ERR(dmi_kset)) {
+		error = PTR_ERR(dmi_kset);
 		goto err;
+	}
 
 	val = 0;
 	error = dmi_walk(dmi_sysfs_register_handle, &val);
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index e229576..c3bc8f1 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -757,8 +757,8 @@ edd_init(void)
 	}
 
 	edd_kset = kset_create_and_add("edd", NULL, firmware_kobj);
-	if (!edd_kset)
-		return -ENOMEM;
+	if (IS_ERR(edd_kset))
+		return PTR_ERR(edd_kset);
 
 	for (i = 0; i < edd_num_devices(); i++) {
 		edev = kzalloc(sizeof (*edev), GFP_KERNEL);
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
index 463c565..057568f 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -730,9 +730,9 @@ int efivars_sysfs_init(void)
 	       EFIVARS_DATE);
 
 	efivars_kset = kset_create_and_add("vars", NULL, parent_kobj);
-	if (!efivars_kset) {
+	if (IS_ERR(efivars_kset)) {
 		printk(KERN_ERR "efivars: Subsystem registration failed.\n");
-		return -ENOMEM;
+		return PTR_ERR(efivars_kset);
 	}
 
 	efivar_init(efivars_sysfs_callback, NULL, false,
diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c
index 97cdd16..df881b1 100644
--- a/drivers/firmware/efi/runtime-map.c
+++ b/drivers/firmware/efi/runtime-map.c
@@ -113,8 +113,8 @@ add_sysfs_runtime_map_entry(struct kobject *kobj, int nr)
 
 	if (!map_kset) {
 		map_kset = kset_create_and_add("runtime-map", NULL, kobj);
-		if (!map_kset)
-			return ERR_PTR(-ENOMEM);
+		if (IS_ERR(map_kset))
+			return ERR_CAST(map_kset);
 	}
 
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 17cf96c..23e40c9 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -186,8 +186,8 @@ static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
 
 	if (!mmap_kset) {
 		mmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj);
-		if (!mmap_kset)
-			return -ENOMEM;
+		if (IS_ERR(mmap_kset))
+			return PTR_ERR(mmap_kset);
 	}
 
 	entry->kobj.kset = mmap_kset;
-- 
1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ