summaryrefslogtreecommitdiff
path: root/fs/cramfs
diff options
context:
space:
mode:
authorDaniel Schaeffer <daniel@dschaeffer.localdomain>2008-02-01 12:27:23 -0500
committerDaniel Schaeffer <daniel@dschaeffer.localdomain>2008-02-01 12:27:23 -0500
commit50c8843a4a66f7b3005d1d1267413a88c63e2103 (patch)
treebdb9dce43fd926a451f3b890c002cc173f8caf22 /fs/cramfs
parent0f7efc5cb585cf74868de2232fc6c34b94c70d20 (diff)
parent49914084e797530d9baaf51df9eda77babc98fa8 (diff)
Merge branch '2.6.24' into 2.6.24-imx27
Conflicts: MAINTAINERS Makefile arch/arm/Kconfig arch/arm/oprofile/Kconfig drivers/Makefile drivers/ata/Kconfig drivers/ata/Makefile drivers/char/watchdog/Kconfig drivers/char/watchdog/Makefile drivers/ide/Kconfig drivers/input/touchscreen/Kconfig drivers/input/touchscreen/Makefile drivers/mmc/card/block.c drivers/mmc/card/sdio_uart.c drivers/mmc/core/Makefile drivers/mmc/core/mmc_ops.c drivers/mmc/core/sdio.c drivers/mmc/core/sdio_bus.c drivers/mmc/core/sdio_cis.c drivers/mmc/core/sdio_io.c drivers/mmc/core/sdio_irq.c drivers/mmc/core/sdio_ops.c drivers/mmc/host/Kconfig drivers/mmc/host/Makefile drivers/mmc/host/au1xmmc.c drivers/mmc/host/tifm_sd.c drivers/mtd/maps/Makefile drivers/pcmcia/Kconfig drivers/pcmcia/Makefile fs/exec.c include/linux/mmc/card.h include/linux/mmc/host.h include/linux/mmc/sdio_func.h include/linux/mmc/sdio_ids.h include/linux/mod_devicetable.h mm/hugetlb.c scripts/mod/file2alias.c
Diffstat (limited to 'fs/cramfs')
-rw-r--r--fs/cramfs/inode.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index f12a7e2b97fa..55f976db655b 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -264,7 +264,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
{
struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
struct page *pages[BLKS_PER_BUF];
- unsigned i, blocknr, buffer, unread;
+ unsigned i, blocknr, buffer;
unsigned long devsize;
char *data;
@@ -291,7 +291,6 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
devsize = mapping->host->i_size >> PAGE_CACHE_SHIFT;
/* Ok, read in BLKS_PER_BUF pages completely first. */
- unread = 0;
for (i = 0; i < BLKS_PER_BUF; i++) {
struct page *page = NULL;
@@ -416,12 +415,21 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
/* Do sanity checks on the superblock */
if (super.magic != CRAMFS_MAGIC) {
+ /* check for wrong endianess */
+ if (super.magic == CRAMFS_MAGIC_WEND) {
+ if (!silent)
+ printk(KERN_ERR "cramfs: wrong endianess\n");
+ goto out;
+ }
+
/* check at 512 byte offset */
mutex_lock(&read_mutex);
memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
mutex_unlock(&read_mutex);
if (super.magic != CRAMFS_MAGIC) {
- if (!silent)
+ if (super.magic == CRAMFS_MAGIC_WEND && !silent)
+ printk(KERN_ERR "cramfs: wrong endianess\n");
+ else if (!silent)
printk(KERN_ERR "cramfs: wrong magic\n");
goto out;
}
@@ -530,7 +538,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if (offset & 3)
return -EINVAL;
- buf = kmalloc(256, GFP_KERNEL);
+ buf = kmalloc(CRAMFS_MAXPATHLEN, GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -544,7 +552,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
int namelen, error;
mutex_lock(&read_mutex);
- de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256);
+ de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
name = (char *)(de+1);
/*
@@ -594,7 +602,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s
char *name;
int namelen, retval;
- de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+256);
+ de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
name = (char *)(de+1);
/* Try to take advantage of sorted directories */