Commit 4826d83d9c4f6bbf61f997e7b68547b4bffd8a49

Authored by Ajeet Yadav
Committed by Phillip Lougher
1 parent 192cfd5877

Squashfs: use define instead of constant

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>

Showing 3 changed files with 5 additions and 4 deletions Side-by-side Diff

... ... @@ -173,8 +173,7 @@
173 173  
174 174 dir_count = le32_to_cpu(dirh.count) + 1;
175 175  
176   - /* dir_count should never be larger than 256 */
177   - if (dir_count > 256)
  176 + if (dir_count > SQUASHFS_DIR_COUNT)
178 177 goto failed_read;
179 178  
180 179 while (dir_count--) {
... ... @@ -177,8 +177,7 @@
177 177  
178 178 dir_count = le32_to_cpu(dirh.count) + 1;
179 179  
180   - /* dir_count should never be larger than 256 */
181   - if (dir_count > 256)
  180 + if (dir_count > SQUASHFS_DIR_COUNT)
182 181 goto data_error;
183 182  
184 183 while (dir_count--) {
fs/squashfs/squashfs_fs.h
... ... @@ -52,6 +52,9 @@
52 52 /* Max length of filename (not 255) */
53 53 #define SQUASHFS_NAME_LEN 256
54 54  
  55 +/* Max value for directory header count*/
  56 +#define SQUASHFS_DIR_COUNT 256
  57 +
55 58 #define SQUASHFS_INVALID_FRAG (0xffffffffU)
56 59 #define SQUASHFS_INVALID_XATTR (0xffffffffU)
57 60 #define SQUASHFS_INVALID_BLK (-1LL)