[PATCH 6/10] squashfs: conserve stack, remove casts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jörn

-- 
All art is but imitation of nature.
-- Lucius Annaeus Seneca


Signed-off-by: Jörn Engel <[email protected]>
---

 fs/squashfs/inode.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

--- linux-2.6.12-rc3cow/fs/squashfs/inode.c~squashfs_cu6	2005-04-22 07:21:11.523554656 +0200
+++ linux-2.6.12-rc3cow/fs/squashfs/inode.c	2005-04-22 09:17:45.607292312 +0200
@@ -1405,12 +1405,15 @@ static int get_dir_index_using_name(stru
 	squashfs_sb_info *msBlk = s->s_fs_info;
 	squashfs_super_block *sBlk = &msBlk->sBlk;
 	int i, length = 0;
-	char buffer[sizeof(squashfs_dir_index) + SQUASHFS_NAME_LEN + 1];
-	squashfs_dir_index *index = (squashfs_dir_index *) buffer;
+	squashfs_dir_index *index;
 	char str[SQUASHFS_NAME_LEN + 1];
 
 	TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count);
 
+	index = kmalloc(sizeof(*index) + SQUASHFS_NAME_LEN + 1, GFP_KERNEL);
+	if (!index)
+		return -ENOMEM;
+
 	strncpy(str, name, size);
 	str[size] = '\0';
 
@@ -1442,6 +1445,7 @@ static int get_dir_index_using_name(stru
 	}
 
 	*next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
+	kfree(index);
 	return length;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux