Skip to contentSkip to conversation

kernel-2.6.9: make sock_init() notice errors

KJ walter harms 1 participant 1 message Nov 27, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi list,
by accident i found that that sock_init never checks the return code of called init functions. I have no idea why this is not done so i added only a printk() to inform the user about the problem.
The function returns no error indicator. i left it this way.

re,
walter

net/socket.c renamed from net/socket.c.bak +20 -2
@@ -2032,6 +2032,7 @@
 void __init sock_init(void)
 {
 	int i;
+	int ret;
 
 	/*
 	 *	Initialize all address (protocol) families.
@@ -2057,9 +2058,26 @@
 	 *	Initialize the protocols module.
 	 */
 
-	init_inodecache();
-	register_filesystem(&sock_fs_type);
+	ret=init_inodecache();
+	if ( ret < 0 ) {
+		printk(KERN_CRIT "%s : init_inodecache failed\n",__FUNCTION__);
+		return;
+	}
+
+	ret=register_filesystem(&sock_fs_type);
+
+	if ( ret < 0 ) {
+		printk(KERN_CRIT "%s : can not register sock_fs\n",__FUNCTION__);
+		return;
+	}
+
+
 	sock_mnt = kern_mount(&sock_fs_type);
+	if (IS_ERR(sock_mnt)) {
+		printk(KERN_CRIT "%s : can not mount sock_fs\n",__FUNCTION__);
+		return;
+	}
+
 	/* The real protocol initialization is performed when
 	 *  do_initcalls is run.
 	 */

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors