Squashfs: use define instead of constant
authorAjeet Yadav <ajeet.yadav.77@gmail.com>
Thu, 2 Feb 2012 07:34:49 +0000 (13:04 +0530)
committerPhillip Lougher <phillip@squashfs.org.uk>
Sat, 10 Mar 2012 03:00:54 +0000 (03:00 +0000)
Its better to use defined name instead of constant

Signed-off-by: Ajeet Yadav <ajeet.yadav.77@gmail.com>
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
fs/squashfs/dir.c
fs/squashfs/namei.c
fs/squashfs/squashfs_fs.h

index 9dfe2ce0fb70f0b0caee3d14c9f0f3026bf5d3f4..4a812bfcdd5ea5b688a4289320605375e4ee766c 100644 (file)
@@ -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--) {
index 0682b38d7e316beecc2c8ffe0a5c29b5e4997288..66c70fc8c80bf40343377a1efc2240a3a25f2d54 100644 (file)
@@ -177,8 +177,7 @@ static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
 
                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 data_error;
 
                while (dir_count--) {
index e8e14645de9a8107f6aa573e7392e7f95fae53bb..b2f9f623ac980aae6de930fa10bfaad8f0133611 100644 (file)
@@ -52,6 +52,9 @@
 /* Max length of filename (not 255) */
 #define SQUASHFS_NAME_LEN              256
 
+/* Max value for directory header count*/
+#define SQUASHFS_DIR_COUNT             256
+
 #define SQUASHFS_INVALID_FRAG          (0xffffffffU)
 #define SQUASHFS_INVALID_XATTR         (0xffffffffU)
 #define SQUASHFS_INVALID_BLK           (-1LL)