fuse_file_alloc(): fix NULL dereferences
authorAdrian Bunk <bunk@kernel.org>
Thu, 15 Nov 2007 01:00:02 +0000 (17:00 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:42 +0000 (18:45 -0800)
Fix obvious NULL dereferences spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fuse/file.c

index 0fcdba9d47c090ba5b6dae59abfdc41897d5b7f1..535b37399009128df2413d3b7632160390113b9c 100644 (file)
@@ -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;
 }