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: <20240729073511.61935-1-zhangjiao2@cmss.chinamobile.com>
Date: Mon, 29 Jul 2024 15:35:11 +0800
From: zhangjiao2 <zhangjiao2@...s.chinamobile.com>
To: arnd@...db.de
Cc: gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org,
	trivial@...nel.org,
	Zhang Jiao <zhangjiao2@...s.chinamobile.com>
Subject: [PATCH] char: misc: add missing #ifdef CONFIG_PROC_FS and error checking

From: Zhang Jiao <zhangjiao2@...s.chinamobile.com>

Add "#ifdef CONFIG_PROC_FS" to control misc proc create 
and give some error checking.

Signed-off-by: Zhang Jiao <zhangjiao2@...s.chinamobile.com>
---
 drivers/char/misc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 541edc26ec89..0370d53f368a 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -286,9 +286,15 @@ EXPORT_SYMBOL(misc_deregister);
 static int __init misc_init(void)
 {
 	int err;
+#ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *ret;
 
 	ret = proc_create_seq("misc", 0, NULL, &misc_seq_ops);
+	if (!ret) {
+		pr_err("Cannot create /proc/misc\n");
+		return -ENOMEM;
+	}
+#endif
 	err = class_register(&misc_class);
 	if (err)
 		goto fail_remove;
@@ -302,8 +308,10 @@ static int __init misc_init(void)
 	pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
 	class_unregister(&misc_class);
 fail_remove:
+#ifdef CONFIG_PROC_FS
 	if (ret)
 		remove_proc_entry("misc", NULL);
+#endif
 	return err;
 }
 subsys_initcall(misc_init);
-- 
2.33.0




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ