Skip to contentSkip to conversation

fs: proc: check status of register_filesystem

PATCH In review Kangjie Lu 4 participants 5 messages Dec 26, 2018 – Jan 2, 2019

Subsystems (2)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 fs: proc: check status of register_filesystem

register_filesystem() could fail. The fix issues an error message if it fails.

---
 fs/proc/root.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/root.c +2 -1
index f4b1a9d2eca6..7dcd947cba23 100644
@@ -141,7 +141,8 @@ void __init proc_root_init(void)
 	proc_mkdir("bus", NULL);
 	proc_sys_init();
 
-	register_filesystem(&proc_fs_type);
+	if (register_filesystem(&proc_fs_type))
+		pr_err("failed to register the filesystem.\n");
 }
 
 static int proc_root_getattr(const struct path *path, struct kstat *stat,
Signature · 1 line
2.17.2 (Apple Git-113)
#1 lore raw

fs/proc/root.c void __init proc_root_init(void) · line 145

Quoted 6 lines · Kangjie Lu

register_filesystem() could fail. The fix issues an error message if it fails.

fs/proc/root.c +2 -1
-	register_filesystem(&proc_fs_type);
+	if (register_filesystem(&proc_fs_type))
+		pr_err("failed to register the filesystem.\n");

No, register_filesystem() should do it.

maintainer
#2 lore raw
Quoted 9 lines · Alexey Dobriyan

fs/proc/root.c void __init proc_root_init(void) · line 145

Quoted 6 lines · Kangjie Lu

register_filesystem() could fail. The fix issues an error message if it fails.

fs/proc/root.c +2 -1
-	register_filesystem(&proc_fs_type);
+	if (register_filesystem(&proc_fs_type))
+		pr_err("failed to register the filesystem.\n");

No, register_filesystem() should do it.

Folks, check when would it fail. If we have something called "proc" already registered by the time when proc_root_init() runs... might as well have been a panic().

#3 lore raw
In reply to Alexey Dobriyan
Quoted 5 lines · Alexey Dobriyan

fs/proc/root.c void __init proc_root_init(void) · line 145

Quoted 3 lines
fs/proc/root.c +2 -1
-	register_filesystem(&proc_fs_type);
+	if (register_filesystem(&proc_fs_type))
+		pr_err("failed to register the filesystem.\n");

No, register_filesystem() should do it.

+1

David

#4 lore raw
In reply to Kangjie Lu

fs/proc/root.c void __init proc_root_init(void) · line 145

Quoted 1 line · Kangjie Lu
fs/proc/root.c +1 -0
+		pr_err("failed to register the filesystem.\n");

Is it worth saying which filesystem?

David