OSDN Git Service

intermezzo: fix uninitialized use of pointer in error path
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Apr 2008 10:01:15 +0000 (12:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Apr 2008 10:01:15 +0000 (12:01 +0200)
gcc pointed out the following issue :
  dcache.c: In function `presto_set_dd':
  dcache.c:251: warning: `fset' might be used uninitialized in this function

fset is not yet assigned in the error path, so no operation must be done
with it.

fs/intermezzo/dcache.c

index 12184ae..61e8e9e 100644 (file)
@@ -248,7 +248,7 @@ inline struct presto_dentry_data *izo_alloc_ddata(void)
 /* This uses the BKL! */
 int presto_set_dd(struct dentry * dentry)
 {
-        struct presto_file_set *fset;
+        struct presto_file_set *fset = NULL;
         struct presto_dentry_data *dd;
         int is_under_d_izo;
         int error=0;
@@ -325,9 +325,11 @@ out_unlock:
                         dentry->d_fsdata);
         unlock_kernel();
 
-        filter_setup_dentry_ops(fset->fset_cache->cache_filter,
-                                dentry->d_op, &presto_dentry_ops);
-        dentry->d_op = filter_c2udops(fset->fset_cache->cache_filter);
+       if (fset) {
+               filter_setup_dentry_ops(fset->fset_cache->cache_filter,
+                                       dentry->d_op, &presto_dentry_ops);
+               dentry->d_op = filter_c2udops(fset->fset_cache->cache_filter);
+       }
 
         return error; 
 }