[2.6 patch] fuse_file_alloc(): fix NULL dereferences

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Adrian Bunk
Date: Friday, October 19, 2007 - 7:05 am

This patch fixes obvious NULL dereferences spotted by the Coverity 
checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
53b7c67ef9b6c26a0c7f554fef43021633a48ab7 
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 0fcdba9..535b373 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -55,9 +55,10 @@ struct fuse_file *fuse_file_alloc(void)
 		if (!ff->reserved_req) {
 			kfree(ff);
 			ff = NULL;
+		} else {
+			INIT_LIST_HEAD(&ff->write_entry);
+			atomic_set(&ff->count, 0);
 		}
-		INIT_LIST_HEAD(&ff->write_entry);
-		atomic_set(&ff->count, 0);
 	}
 	return ff;
 }

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[2.6 patch] fuse_file_alloc(): fix NULL dereferences, Adrian Bunk, (Fri Oct 19, 7:05 am)
Re: [2.6 patch] fuse_file_alloc(): fix NULL dereferences, Miklos Szeredi, (Fri Oct 19, 7:14 am)