From: Andrew Morton Steven Rostedt points out that `rsv' here is usually NULL, so we should avoid calling kfree(). Also, fix up some nearby whitespace damage. Signed-off-by: Andrew Morton --- fs/ext3/super.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff -puN fs/ext3/super.c~ext3_clear_inode-avoid-kfree-null fs/ext3/super.c --- devel/fs/ext3/super.c~ext3_clear_inode-avoid-kfree-null 2006-04-23 14:06:12.000000000 -0700 +++ devel-akpm/fs/ext3/super.c 2006-04-23 14:06:12.000000000 -0700 @@ -499,20 +499,21 @@ static void ext3_clear_inode(struct inod { struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; #ifdef CONFIG_EXT3_FS_POSIX_ACL - if (EXT3_I(inode)->i_acl && - EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { - posix_acl_release(EXT3_I(inode)->i_acl); - EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; - } - if (EXT3_I(inode)->i_default_acl && - EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { - posix_acl_release(EXT3_I(inode)->i_default_acl); - EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; - } + if (EXT3_I(inode)->i_acl && + EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { + posix_acl_release(EXT3_I(inode)->i_acl); + EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; + } + if (EXT3_I(inode)->i_default_acl && + EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { + posix_acl_release(EXT3_I(inode)->i_default_acl); + EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; + } #endif ext3_discard_reservation(inode); EXT3_I(inode)->i_block_alloc_info = NULL; - kfree(rsv); + if (unlikely(rsv)) + kfree(rsv); } static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) _