aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cramfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cramfs/inode.c')
-rw-r--r--fs/cramfs/inode.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 5c817bd08389..350680fd7da7 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -148,7 +148,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
148{ 148{
149 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; 149 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
150 struct page *pages[BLKS_PER_BUF]; 150 struct page *pages[BLKS_PER_BUF];
151 unsigned i, blocknr, buffer, unread; 151 unsigned i, blocknr, buffer;
152 unsigned long devsize; 152 unsigned long devsize;
153 char *data; 153 char *data;
154 154
@@ -175,7 +175,6 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
175 devsize = mapping->host->i_size >> PAGE_CACHE_SHIFT; 175 devsize = mapping->host->i_size >> PAGE_CACHE_SHIFT;
176 176
177 /* Ok, read in BLKS_PER_BUF pages completely first. */ 177 /* Ok, read in BLKS_PER_BUF pages completely first. */
178 unread = 0;
179 for (i = 0; i < BLKS_PER_BUF; i++) { 178 for (i = 0; i < BLKS_PER_BUF; i++) {
180 struct page *page = NULL; 179 struct page *page = NULL;
181 180
@@ -362,7 +361,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
362 if (offset & 3) 361 if (offset & 3)
363 return -EINVAL; 362 return -EINVAL;
364 363
365 buf = kmalloc(256, GFP_KERNEL); 364 buf = kmalloc(CRAMFS_MAXPATHLEN, GFP_KERNEL);
366 if (!buf) 365 if (!buf)
367 return -ENOMEM; 366 return -ENOMEM;
368 367
@@ -376,7 +375,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
376 int namelen, error; 375 int namelen, error;
377 376
378 mutex_lock(&read_mutex); 377 mutex_lock(&read_mutex);
379 de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256); 378 de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
380 name = (char *)(de+1); 379 name = (char *)(de+1);
381 380
382 /* 381 /*
@@ -426,7 +425,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s
426 char *name; 425 char *name;
427 int namelen, retval; 426 int namelen, retval;
428 427
429 de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+256); 428 de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
430 name = (char *)(de+1); 429 name = (char *)(de+1);
431 430
432 /* Try to take advantage of sorted directories */ 431 /* Try to take advantage of sorted directories */