Skip to contentSkip to conversation

vfs: initialize d_iname to null for long file names

PATCH In review Wu Fengguang 2 participants 2 messages Nov 26, 2008 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfs: initialize d_iname to null for long file names

dentry->d_iname is currently uninitialized for long file names. Init it to null string to avoid bad behaviors on careless references to it.

---

fs/dcache.c +1 -0
index a1d86c7..29d1768 100644
@@ -929,6 +929,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
 			kmem_cache_free(dentry_cache, dentry); 
 			return NULL;
 		}
+		dentry->d_iname[0] = '\0';
 	} else  {
 		dname = dentry->d_iname;
 	}	
#1 lore raw
Quoted 2 lines · Wu Fengguang

dentry->d_iname is currently uninitialized for long file names. Init it to null string to avoid bad behaviors on careless references to it.

I don't really see the point. If your code references it's already buggy. The only proper way to acces it is through dentry->d_name.