[PATCH 2/2] udf: don't pass structs on stack

Previous thread: [RFC patch 3/3] x86: hookup sys_rt_tgsigqueueinfo by Thomas Gleixner on Wednesday, October 1, 2008 - 3:01 am. (1 message)

Next thread: Re: How can i read really 512 byte? by Janos Haar on Wednesday, October 1, 2008 - 3:23 am. (2 messages)
From: Pekka J Enberg
Date: Wednesday, October 1, 2008 - 2:53 am

From: Pekka Enberg <penberg@cs.helsinki.fi>

Fix the udf code not to pass structs on stack where possible.

Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 fs/udf/balloc.c    |   59 +++++++++++++++++++++++--------------------
 fs/udf/dir.c       |    6 ++--
 fs/udf/directory.c |    6 ++--
 fs/udf/ialloc.c    |    4 +-
 fs/udf/inode.c     |   70 ++++++++++++++++++++++++++--------------------------
 fs/udf/misc.c      |    5 ++-
 fs/udf/namei.c     |   31 ++++++++++++----------
 fs/udf/super.c     |   22 ++++++++--------
 fs/udf/truncate.c  |   22 ++++++++--------
 fs/udf/udfdecl.h   |   20 +++++++++-----
 10 files changed, 129 insertions(+), 116 deletions(-)

diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 51bc2b3..c0e87db 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -92,7 +92,7 @@ static int read_block_bitmap(struct super_block *sb,
 	loc.logicalBlockNum = bitmap->s_extPosition;
 	loc.partitionReferenceNum = UDF_SB(sb)->s_partition;
 
-	bh = udf_tread(sb, udf_get_lb_pblock(sb, loc, block));
+	bh = udf_tread(sb, udf_get_lb_pblock(sb, &loc, block));
 	if (!bh)
 		retval = -EIO;
 
@@ -156,11 +156,13 @@ static bool udf_add_free_space(struct udf_sb_info *sbi,
 static void udf_bitmap_free_blocks(struct super_block *sb,
 				   struct inode *inode,
 				   struct udf_bitmap *bitmap,
-				   struct kernel_lb_addr bloc, uint32_t offset,
+				   struct kernel_lb_addr *bloc,
+				   uint32_t offset,
 				   uint32_t count)
 {
 	struct udf_sb_info *sbi = UDF_SB(sb);
 	struct buffer_head *bh = NULL;
+	struct udf_part_map *partmap;
 	unsigned long block;
 	unsigned long block_group;
 	unsigned long bit;
@@ -169,17 +171,17 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
 	unsigned long overflow;
 
 	mutex_lock(&sbi->s_alloc_mutex);
-	if (bloc.logicalBlockNum < 0 ||
-	    (bloc.logicalBlockNum + count) >
-		sbi->s_partmaps[bloc.partitionReferenceNum].s_partition_len) {
+	partmap = ...
Previous thread: [RFC patch 3/3] x86: hookup sys_rt_tgsigqueueinfo by Thomas Gleixner on Wednesday, October 1, 2008 - 3:01 am. (1 message)

Next thread: Re: How can i read really 512 byte? by Janos Haar on Wednesday, October 1, 2008 - 3:23 am. (2 messages)