1 From: Mingming Cao <cmm@us.ibm.com>
4 On Tue, 2007-07-10 at 21:42 -0700, Andrew Morton wrote:
5 On Tue, 10 Jul 2007 23:21:49 -0400 "Cédric Augonnet" <cedric.augonnet@gmail.com> wrote:
7 > > 2007/7/10, Andrew Morton <akpm@linux-foundation.org>:
11 > > > > + size = sizeof(struct transaction_stats_s);
12 > > > > + s->stats = kmalloc(size, GFP_KERNEL);
13 > > > > + if (s == NULL) {
15 > > > > + return -EIO;
19 > > I'm sorry if i missed some point, but i just don't see the use of such
20 > > a kfree here, not sure Andrew meant you should only return ENOMEM
21 > > instead, but why issuing those kfree(NULL), instead of just a if (!s)
25 > You found a bug. It was meant to be
27 > if (s->stats == NULL)
30 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
33 fs/jbd2/journal.c | 2 +-
34 include/linux/jbd2.h | 3 +++
35 2 files changed, 4 insertions(+), 1 deletion(-)
38 Index: linux-2.6.23-rc6/fs/jbd2/journal.c
39 ===================================================================
40 --- linux-2.6.23-rc6.orig/fs/jbd2/journal.c 2007-09-20 17:26:01.000000000 -0700
41 +++ linux-2.6.23-rc6/fs/jbd2/journal.c 2007-09-20 17:26:02.000000000 -0700
42 @@ -751,7 +751,7 @@ static int jbd2_seq_history_open(struct
44 size = sizeof(struct transaction_stats_s) * journal->j_history_max;
45 s->stats = kmalloc(size, GFP_KERNEL);
47 + if (s->stats == NULL) {
51 Index: linux-2.6.23-rc6/include/linux/jbd2.h
52 ===================================================================
53 --- linux-2.6.23-rc6.orig/include/linux/jbd2.h 2007-09-20 17:26:01.000000000 -0700
54 +++ linux-2.6.23-rc6/include/linux/jbd2.h 2007-09-20 17:26:02.000000000 -0700
55 @@ -941,6 +941,9 @@ struct journal_s
56 struct transaction_stats_s *j_history;
60 + * Protect the transactions statistics history
62 spinlock_t j_history_lock;
63 struct proc_dir_entry *j_proc_entry;
64 struct transaction_stats_s j_stats;