Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756598Ab2HVHHv (ORCPT ); Wed, 22 Aug 2012 03:07:51 -0400 Received: from LGEMRELSE7Q.lge.com ([156.147.1.151]:56465 "EHLO LGEMRELSE7Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755803Ab2HVHHV (ORCPT ); Wed, 22 Aug 2012 03:07:21 -0400 X-AuditID: 9c930197-b7bb2ae0000011d9-fa-503485274c05 From: Namhyung Kim To: Steven Rostedt , Arnaldo Carvalho de Melo Cc: Frederic Weisbecker , Peter Zijlstra , Ingo Molnar , LKML , Namhyung Kim Subject: [PATCH 1/4] tools lib traceevent: Do not link broken field arg for an old ftrace event Date: Wed, 22 Aug 2012 16:00:28 +0900 Message-Id: <1345618831-9148-2-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1345618831-9148-1-git-send-email-namhyung@kernel.org> References: <1345618831-9148-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1594 Lines: 50 From: Namhyung Kim Defer linking a newly allocated arg to print_fmt.args until all of its field is setup so that later access to ->field.name cannot be NULL. Cc: Frederic Weisbecker Acked-by: Steven Rostedt Link: http://lkml.kernel.org/n/tip-7zlkindw0qqqe5h117u59ood@git.kernel.org Signed-off-by: Namhyung Kim --- tools/lib/traceevent/event-parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index b7c2c491f61e..33fcd943f096 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -4754,20 +4754,20 @@ int pevent_parse_event(struct pevent *pevent, struct print_arg *arg, **list; /* old ftrace had no args */ - list = &event->print_fmt.args; for (field = event->format.fields; field; field = field->next) { arg = alloc_arg(); - *list = arg; - list = &arg->next; arg->type = PRINT_FIELD; arg->field.name = strdup(field->name); if (!arg->field.name) { do_warning("failed to allocate field name"); event->flags |= EVENT_FL_FAILED; + free_arg(arg); return -1; } arg->field.field = field; + *list = arg; + list = &arg->next; } return 0; } -- 1.7.11.4 -- 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/