Re: [PATCH V3 01/17] Squashfs: inode operations

From: Evgeniy Polyakov
Date: Mon Jan 05 2009 - 08:20:23 EST


Hi.

On Mon, Jan 05, 2009 at 11:08:23AM +0000, Phillip Lougher (phillip@xxxxxxxxxxxxxxxxxxx) wrote:
> +int squashfs_read_inode(struct inode *inode, long long ino)
> +{
> + struct super_block *sb = inode->i_sb;
> + struct squashfs_sb_info *msblk = sb->s_fs_info;
> + u64 block = SQUASHFS_INODE_BLK(ino) + msblk->inode_table;
> + int err, type, offset = SQUASHFS_INODE_OFFSET(ino);
> + union squashfs_inode squashfs_ino;
> + struct squashfs_base_inode *sqshb_ino = &squashfs_ino.base;
> +

What's the size of that union? If big enough it will lead to some
problems.

> + TRACE("Entered squashfs_read_inode\n");
> +
> + /*
> + * Read inode base common to all inode types.
> + */
> + err = squashfs_read_metadata(sb, sqshb_ino, &block,
> + &offset, sizeof(*sqshb_ino));
> + if (err < 0)
> + goto failed_read;
> +
> + err = squashfs_new_inode(sb, inode, sqshb_ino);
> + if (err)
> + goto failed_read;
> +
> + block = SQUASHFS_INODE_BLK(ino) + msblk->inode_table;
> + offset = SQUASHFS_INODE_OFFSET(ino);
> +
> + type = le16_to_cpu(sqshb_ino->inode_type);
> + switch (type) {
> + case SQUASHFS_REG_TYPE: {
> + unsigned int frag_offset, frag_size, frag;
> + u64 frag_blk;

Above variables can be moved out of the switch, since they are used in
some other cases too.

--
Evgeniy Polyakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/