[PATCH] ext3_clear_inode(): avoid kfree(NULL)
Steven Rostedt <rostedt@goodmis.org> 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 <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
304c4c841a
commit
e6022603b9
@@ -499,20 +499,21 @@ static void ext3_clear_inode(struct inode *inode)
|
|||||||
{
|
{
|
||||||
struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info;
|
struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info;
|
||||||
#ifdef CONFIG_EXT3_FS_POSIX_ACL
|
#ifdef CONFIG_EXT3_FS_POSIX_ACL
|
||||||
if (EXT3_I(inode)->i_acl &&
|
if (EXT3_I(inode)->i_acl &&
|
||||||
EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) {
|
EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) {
|
||||||
posix_acl_release(EXT3_I(inode)->i_acl);
|
posix_acl_release(EXT3_I(inode)->i_acl);
|
||||||
EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED;
|
EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED;
|
||||||
}
|
}
|
||||||
if (EXT3_I(inode)->i_default_acl &&
|
if (EXT3_I(inode)->i_default_acl &&
|
||||||
EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) {
|
EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) {
|
||||||
posix_acl_release(EXT3_I(inode)->i_default_acl);
|
posix_acl_release(EXT3_I(inode)->i_default_acl);
|
||||||
EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED;
|
EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ext3_discard_reservation(inode);
|
ext3_discard_reservation(inode);
|
||||||
EXT3_I(inode)->i_block_alloc_info = NULL;
|
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)
|
static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb)
|
||||||
|
Reference in New Issue
Block a user