Message ID | 1444826502-49291-13-git-send-email-wangnan0@huawei.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBD2YXXXCQEBBBCM67GYAKGQEAS477MA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 2400023012 for <linaro@patches.linaro.org>; Wed, 14 Oct 2015 12:48:10 +0000 (UTC) Received: by lfaz124 with SMTP id z124sf562161lfa.0 for <linaro@patches.linaro.org>; Wed, 14 Oct 2015 05:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=22C4yg7Gf7mAI85+RQmDa3acX90+X6xcrIkPXCY8pLw=; b=C4xcCF70KztJ4s4VmMLWLvo+daAA3It/t9DLpN5+g1diUgRK3ni+pdbjJenOMKigtE i6jBpKHxLJrVEJ6/KUXtMkdtyCnRX7aMGy8JcBg4QmT/yTneygduJO+KBGGri3j9gHH9 ZCwYO7q1T4ZFIqgAH2E4rHiHcBjLJSVdyIj6a4LKtlqLRCOkIEkNJq8Jy37KoRqmPGxX hEjNyH0DWxed7XPY79pw7XGYw7orC605Itc3I7ALY7cVfG/RACM29gvg/LxFJxJ+5hAE I8QCZxrRE/DLdJ8/OcMq4XXMG0H/Wd6c9XpMhJj7O5eFwZuUIXZEjPfbWCy/BF4GMvSI gAbQ== X-Gm-Message-State: ALoCoQlqs3jwf8XJL8goXM5FemuzUhAWo+bt2WQfA7QqnX0hNpO7qsYEIfol/oYq7nZ5zAF6flKX X-Received: by 10.194.109.233 with SMTP id hv9mr724068wjb.1.1444826889063; Wed, 14 Oct 2015 05:48:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.44.79 with SMTP id s76ls36714lfs.29.gmail; Wed, 14 Oct 2015 05:48:08 -0700 (PDT) X-Received: by 10.112.205.231 with SMTP id lj7mr1514906lbc.57.1444826888878; Wed, 14 Oct 2015 05:48:08 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id py9si5436686lbb.105.2015.10.14.05.48.08 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Oct 2015 05:48:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbbpp2 with SMTP id pp2so16054353lbb.0 for <patchwork-forward@linaro.org>; Wed, 14 Oct 2015 05:48:08 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr1503376lbc.72.1444826888728; Wed, 14 Oct 2015 05:48:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2712234lbq; Wed, 14 Oct 2015 05:48:07 -0700 (PDT) X-Received: by 10.66.144.165 with SMTP id sn5mr3695816pab.122.1444826887507; Wed, 14 Oct 2015 05:48:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yi1si13024215pbb.246.2015.10.14.05.47.59; Wed, 14 Oct 2015 05:48:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753582AbbJNMr5 (ORCPT <rfc822;pingbo.wen@linaro.org> + 30 others); Wed, 14 Oct 2015 08:47:57 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:4043 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753604AbbJNMm4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 14 Oct 2015 08:42:56 -0400 Received: from 172.24.1.47 (EHLO szxeml425-hub.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CUF02899; Wed, 14 Oct 2015 20:42:29 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml425-hub.china.huawei.com (10.82.67.180) with Microsoft SMTP Server id 14.3.235.1; Wed, 14 Oct 2015 20:42:19 +0800 From: Wang Nan <wangnan0@huawei.com> To: <acme@kernel.org>, <ast@plumgrid.com>, <brendan.d.gregg@gmail.com> CC: <a.p.zijlstra@chello.nl>, <daniel@iogearbox.net>, <dsahern@gmail.com>, <hekuang@huawei.com>, <jolsa@kernel.org>, <lizefan@huawei.com>, <masami.hiramatsu.pt@hitachi.com>, <namhyung@kernel.org>, <paulus@samba.org>, <linux-kernel@vger.kernel.org>, <pi3orama@163.com>, <xiakaixu@huawei.com>, Wang Nan <wangnan0@huawei.com>, Arnaldo Carvalho de Melo <acme@redhat.com> Subject: [PATCH 12/31] perf probe: Reset args and nargs for probe_trace_event when failure Date: Wed, 14 Oct 2015 12:41:23 +0000 Message-ID: <1444826502-49291-13-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1444826502-49291-1-git-send-email-wangnan0@huawei.com> References: <1444826502-49291-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: wangnan0@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index bd8f03d..b1581d7 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1235,6 +1235,10 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) end: free(args); + if (ret) { + tev->nargs = 0; + zfree(&tev->args); + } return ret; }
When failure occures in add_probe_trace_event(), args in probe_trace_event is incomplete. Since information in it may be used in futher, this patch frees the allocated memory and set it to NULL to avoid dangling pointer. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Brendan Gregg <brendan.d.gregg@gmail.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: David Ahern <dsahern@gmail.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kaixu Xia <xiakaixu@huawei.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lkml.kernel.org/n/ebpf-6yw9eg0ej3l4jnqhinngkw86@git.kernel.org --- tools/perf/util/probe-finder.c | 4 ++++ 1 file changed, 4 insertions(+)