Re: use of uninitialized pointer in jffs_create()

Alexey Dobriyan
2005-08-21T09:06:01Z

On Sun, Aug 21, 2005 at 12:28:08AM +0200, Jesper Juhl wrote:
> gcc kindly pointed me at jffs_create() with this warning :
>
> fs/jffs/inode-v23.c:1279: warning: `inode' might be used uninitialized
> in this function

I don't see a warning with latest gcc-4.1 snapshot.

> And looking at the function :
>
> static int
> jffs_create(struct inode *dir, struct dentry *dentry, int mode,
> struct nameidata *nd)
> {
> struct jffs_raw_inode raw_inode;
> struct jffs_control *c;
> struct jffs_node *node;
> struct jffs_file *dir_f; /* JFFS representation of the directory. */
> struct inode *inode;
> int err;
>
> truncate_inode_pages(&inode->i_data, 0);

$ grep truncate_inode_pages -r fs/jffs/
$
?

> I think it is correct. How on earth is that call to
> truncate_inode_pages() going to avoid blowing up? inode has not yet
> been initialized...