diff mbox series

fs: proc: check status of register_filesystem

Message ID 20181226030642.72757-1-kjlu@umn.edu (mailing list archive)
State New, archived
Headers show
Series fs: proc: check status of register_filesystem | expand

Commit Message

Kangjie Lu Dec. 26, 2018, 3:06 a.m. UTC
register_filesystem() could fail. The fix issues an error message if it
fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 fs/proc/root.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexey Dobriyan Dec. 26, 2018, 6:18 a.m. UTC | #1
On Tue, Dec 25, 2018 at 09:06:40PM -0600, Kangjie Lu wrote:
> register_filesystem() could fail. The fix issues an error message if it
> fails.

> -	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.
Al Viro Dec. 26, 2018, 6:58 a.m. UTC | #2
On Wed, Dec 26, 2018 at 09:18:56AM +0300, Alexey Dobriyan wrote:
> On Tue, Dec 25, 2018 at 09:06:40PM -0600, Kangjie Lu wrote:
> > register_filesystem() could fail. The fix issues an error message if it
> > fails.
> 
> > -	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().
David Howells Jan. 2, 2019, 9:38 a.m. UTC | #3
Kangjie Lu <kjlu@umn.edu> wrote:

> +		pr_err("failed to register the filesystem.\n");

Is it worth saying which filesystem?

David
David Howells Jan. 2, 2019, 9:38 a.m. UTC | #4
Alexey Dobriyan <adobriyan@gmail.com> wrote:

> > -	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
diff mbox series

Patch

diff --git a/fs/proc/root.c b/fs/proc/root.c
index f4b1a9d2eca6..7dcd947cba23 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -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,