* [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks
@ 2013-02-13 19:44 Tim Gardner
2013-02-13 19:44 ` [PATCH 2/2 linux-next] ocfs2: ocfs2_begin_truncate_log_recovery(): consolidate status error logging Tim Gardner
2013-02-13 20:01 ` [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
0 siblings, 2 replies; 3+ messages in thread
From: Tim Gardner @ 2013-02-13 19:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Tim Gardner, Mark Fasheh, Joel Becker, ocfs2-devel
smatch analysis:
fs/ocfs2/alloc.c:6138 ocfs2_begin_truncate_log_recovery() info:
redundant null check on *tl_copy calling kfree()
fs/ocfs2/alloc.c:6755 ocfs2_zero_range_for_truncate() info:
redundant null check on pages calling kfree()
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
fs/ocfs2/alloc.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 31b9463..42c0e49 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -6134,11 +6134,8 @@ bail:
iput(tl_inode);
brelse(tl_bh);
- if (status < 0 && (*tl_copy)) {
- kfree(*tl_copy);
- *tl_copy = NULL;
- mlog_errno(status);
- }
+ kfree(*tl_copy);
+ *tl_copy = NULL;
return status;
}
@@ -6751,8 +6748,7 @@ int ocfs2_zero_range_for_truncate(struct inode *inode, handle_t *handle,
mlog_errno(ret);
out:
- if (pages)
- kfree(pages);
+ kfree(pages);
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2 linux-next] ocfs2: ocfs2_begin_truncate_log_recovery(): consolidate status error logging
2013-02-13 19:44 [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
@ 2013-02-13 19:44 ` Tim Gardner
2013-02-13 20:01 ` [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
1 sibling, 0 replies; 3+ messages in thread
From: Tim Gardner @ 2013-02-13 19:44 UTC (permalink / raw)
To: linux-kernel; +Cc: Tim Gardner, Mark Fasheh, Joel Becker, ocfs2-devel
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
fs/ocfs2/alloc.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 42c0e49..1689ca1 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -6090,10 +6090,8 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
trace_ocfs2_begin_truncate_log_recovery(slot_num);
status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh);
- if (status < 0) {
- mlog_errno(status);
+ if (status < 0)
goto bail;
- }
di = (struct ocfs2_dinode *) tl_bh->b_data;
@@ -6109,7 +6107,6 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
*tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL);
if (!(*tl_copy)) {
status = -ENOMEM;
- mlog_errno(status);
goto bail;
}
@@ -6123,10 +6120,8 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check);
status = ocfs2_write_block(osb, tl_bh, INODE_CACHE(tl_inode));
- if (status < 0) {
- mlog_errno(status);
+ if (status < 0)
goto bail;
- }
}
bail:
@@ -6134,6 +6129,9 @@ bail:
iput(tl_inode);
brelse(tl_bh);
+ if (status < 0)
+ mlog_errno(status);
+
kfree(*tl_copy);
*tl_copy = NULL;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks
2013-02-13 19:44 [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
2013-02-13 19:44 ` [PATCH 2/2 linux-next] ocfs2: ocfs2_begin_truncate_log_recovery(): consolidate status error logging Tim Gardner
@ 2013-02-13 20:01 ` Tim Gardner
1 sibling, 0 replies; 3+ messages in thread
From: Tim Gardner @ 2013-02-13 20:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Tim Gardner, Mark Fasheh, Joel Becker, ocfs2-devel
On 02/13/2013 12:44 PM, Tim Gardner wrote:
> fs/ocfs2/alloc.c:6138 ocfs2_begin_truncate_log_recovery() info:
> redundant null check on *tl_copy calling kfree()
Ignore this series. I'll resend.
rtg
--
Tim Gardner tim.gardner@canonical.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-13 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 19:44 [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
2013-02-13 19:44 ` [PATCH 2/2 linux-next] ocfs2: ocfs2_begin_truncate_log_recovery(): consolidate status error logging Tim Gardner
2013-02-13 20:01 ` [PATCH 1/2 linux-next] ocfs2: remove kfree() redundant null checks Tim Gardner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox