From 4826d83d9c4f6bbf61f997e7b68547b4bffd8a49 Mon Sep 17 00:00:00 2001 From: Ajeet Yadav Date: Thu, 2 Feb 2012 13:04:49 +0530 Subject: Squashfs: use define instead of constant Its better to use defined name instead of constant Signed-off-by: Ajeet Yadav Signed-off-by: Phillip Lougher --- fs/squashfs/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/squashfs/dir.c') diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c index 9dfe2ce0fb70..4a812bfcdd5e 100644 --- a/fs/squashfs/dir.c +++ b/fs/squashfs/dir.c @@ -173,8 +173,7 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) dir_count = le32_to_cpu(dirh.count) + 1; - /* dir_count should never be larger than 256 */ - if (dir_count > 256) + if (dir_count > SQUASHFS_DIR_COUNT) goto failed_read; while (dir_count--) { -- cgit v1.2.3 From 68a8c397bf1bc16640e87d229025ffd4e4b54e6c Mon Sep 17 00:00:00 2001 From: Phillip Lougher Date: Tue, 6 Mar 2012 23:02:49 +0000 Subject: Squashfs: remove redundant length initialisation in squashfs_readdir Signed-off-by: Phillip Lougher --- fs/squashfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/squashfs/dir.c') diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c index 4a812bfcdd5e..7142a6fd28d3 100644 --- a/fs/squashfs/dir.c +++ b/fs/squashfs/dir.c @@ -105,7 +105,7 @@ static int squashfs_readdir(struct file *file, void *dirent, filldir_t filldir) struct inode *inode = file->f_dentry->d_inode; struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info; u64 block = squashfs_i(inode)->start + msblk->directory_table; - int offset = squashfs_i(inode)->offset, length = 0, dir_count, size, + int offset = squashfs_i(inode)->offset, length, dir_count, size, type, err; unsigned int inode_number; struct squashfs_dir_header dirh; -- cgit v1.2.3 From 2158d3fd2769546cd9004eaeb776fee946155238 Mon Sep 17 00:00:00 2001 From: Phillip Lougher Date: Fri, 9 Mar 2012 02:27:49 +0000 Subject: Squashfs: fix f_pos check in get_dir_index_using_offset One off error in the f_pos check. If f_pos is 3 or less don't bother reading the index because we're at the start of the directory, and we obviously already know where that is on disk. This eliminates an unnecessary read. Signed-off-by: Phillip Lougher --- fs/squashfs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/squashfs/dir.c') diff --git a/fs/squashfs/dir.c b/fs/squashfs/dir.c index 7142a6fd28d3..b381305c9a47 100644 --- a/fs/squashfs/dir.c +++ b/fs/squashfs/dir.c @@ -64,7 +64,7 @@ static int get_dir_index_using_offset(struct super_block *sb, * is offset by 3 because we invent "." and ".." entries which are * not actually stored in the directory. */ - if (f_pos < 3) + if (f_pos <= 3) return f_pos; f_pos -= 3; -- cgit v1.2.3