Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753174AbZIPO3c (ORCPT ); Wed, 16 Sep 2009 10:29:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752524AbZIPO3b (ORCPT ); Wed, 16 Sep 2009 10:29:31 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.124]:43366 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbZIPO3b (ORCPT ); Wed, 16 Sep 2009 10:29:31 -0400 Subject: Re: [PATCH tracing/kprobes 2/6] ftrace: Fix trace_add_event_call() to initialize list From: Steven Rostedt Reply-To: rostedt@goodmis.org To: Masami Hiramatsu Cc: Frederic Weisbecker , Ingo Molnar , lkml , systemtap , DLE , Jim Keniston , Ananth N Mavinakayanahalli , Andi Kleen , Christoph Hellwig , "Frank Ch. Eigler" , "H. Peter Anvin" , Jason Baron , "K.Prasad" , Lai Jiangshan , Li Zefan , Peter Zijlstra , Srikar Dronamraju , Tom Zanussi In-Reply-To: <4AB0F366.6080000@redhat.com> References: <20090914204847.18779.69409.stgit@dhcp-100-2-132.bos.redhat.com> <20090914204904.18779.59422.stgit@dhcp-100-2-132.bos.redhat.com> <1253058681.20020.147.camel@gandalf.stny.rr.com> <4AB0F366.6080000@redhat.com> Content-Type: text/plain Organization: Kihon Technologies Inc. Date: Wed, 16 Sep 2009 10:29:31 -0400 Message-Id: <1253111371.20020.198.camel@gandalf.stny.rr.com> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1763 Lines: 65 On Wed, 2009-09-16 at 10:17 -0400, Masami Hiramatsu wrote: > Steven Rostedt wrote: > >> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c > >> index ba34920..38e82a5 100644 > >> --- a/kernel/trace/trace_events.c > >> +++ b/kernel/trace/trace_events.c > >> @@ -1009,10 +1009,14 @@ static int __trace_add_event_call(struct ftrace_event_call *call) > >> if (!d_events) > >> return -ENOENT; > >> > >> + INIT_LIST_HEAD(&call->list); > > > > The INIT_LIST_HEAD is not needed here. The list_add will assign it. > > Without initializing it, list debugging code warns always :-) > Please see, __list_add()@lib/list_debug.c /me looks from: include/linux/list.h static inline void list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } from: lib/list_debug.c void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { WARN(next->prev != prev, "list_add corruption. next->prev should be " "prev (%p), but was %p. (next=%p).\n", prev, next->prev, next); WARN(prev->next != next, "list_add corruption. prev->next should be " "next (%p), but was %p. (prev=%p).\n", next, prev->next, prev); next->prev = new; new->next = next; new->prev = prev; prev->next = new; } What you pass in is: list_add(&call->list, &ftrace_events); new = &call->list; prev = &ftrace_events->prev; next = &ftrace_events->next; The above code never tests "new". The INIT_LIST_HEAD is useless. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/