Skip to contentSkip to conversation

futex: init error ckeck

PATCH In review Akinobu Mita 2 participants 2 messages Nov 27, 2006 – Nov 28, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 futex: init error ckeck

This patch checks register_filesystem() and kern_mount() return values.

---
 kernel/futex.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
kernel/futex.c +8 -2
Index: work-fault-inject/kernel/futex.c
===================================================================
@@ -1857,10 +1857,16 @@ static struct file_system_type futex_fs_
 
 static int __init init(void)
 {
-	unsigned int i;
+	int i = register_filesystem(&futex_fs_type);
+
+	if (i)
+		return i;
 
-	register_filesystem(&futex_fs_type);
 	futex_mnt = kern_mount(&futex_fs_type);
+	if (IS_ERR(futex_mnt)) {
+		unregister_filesystem(&futex_fs_type);
+		return PTR_ERR(futex_mnt);
+	}
 
 	for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
 		INIT_LIST_HEAD(&futex_queues[i].chain);