Message ID | 1440822125-52691-21-git-send-email-wangnan0@huawei.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBD2YXXXCQEBBBI7IQSXQKGQE4UMW23A@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 91F0820503 for <linaro@patches.linaro.org>; Sat, 29 Aug 2015 04:25:08 +0000 (UTC) Received: by labd1 with SMTP id d1sf23975706lab.0 for <linaro@patches.linaro.org>; Fri, 28 Aug 2015 21:25:07 -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=OwGIJqpPLFK6XwhyP5IT+lQbh45/+DASP0iFOlYjLYQ=; b=X/7+hpQmup2LtjqkAxKocV0NkB7PZCa0duOWHA2VpbrqLi6wEStpCreFNIOJxUSYuC FdwLFvlihRPaG4wO6sBf9XGZYG6iGB/SS3M4lN7vt63aERGfaHSjW6nZfyjdYpNLuqad oHLezrpJxCAmdBe5Sd7jl8pmuidfWv1fQAiIPVN3h4NZW+i98MNNsHbnmseOR7bDNuuf YOlzPXYX6+1n79ldEQQ8rUKoPBXpquf4CUz8vP9HLTsVXGiG5WusBkUUrdnGSqVM5HZI Yg+DagqdoYk0cRRrhZH5Rs7jTooklgVaJ5cbt4aW0R1BsP0Sts8uknCFkIZ0wMoc9H7o fRxw== X-Gm-Message-State: ALoCoQkt5Qr1aVL0IlKYoyb4XkDtsj4Zsu69t0r4PjHP96ULG/7D8hfgN2TT/glqAQl6ii/fo+72 X-Received: by 10.152.25.199 with SMTP id e7mr3544580lag.1.1440822307626; Fri, 28 Aug 2015 21:25:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.198 with SMTP id 6ls298652law.79.gmail; Fri, 28 Aug 2015 21:25:07 -0700 (PDT) X-Received: by 10.112.181.162 with SMTP id dx2mr6064492lbc.75.1440822307340; Fri, 28 Aug 2015 21:25:07 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id bn6si7662254lbc.95.2015.08.28.21.25.07 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2015 21:25:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laboe4 with SMTP id oe4so17417780lab.0 for <patchwork-forward@linaro.org>; Fri, 28 Aug 2015 21:25:07 -0700 (PDT) X-Received: by 10.152.21.196 with SMTP id x4mr5974047lae.117.1440822307239; Fri, 28 Aug 2015 21:25:07 -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.151.194 with SMTP id us2csp267791lbb; Fri, 28 Aug 2015 21:25:06 -0700 (PDT) X-Received: by 10.68.108.101 with SMTP id hj5mr20207832pbb.156.1440822306199; Fri, 28 Aug 2015 21:25:06 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pt9si3397699pbc.137.2015.08.28.21.25.04; Fri, 28 Aug 2015 21:25:06 -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 S1752957AbbH2EYa (ORCPT <rfc822;matthew.hart@linaro.org> + 28 others); Sat, 29 Aug 2015 00:24:30 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:3803 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752893AbbH2EY0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 29 Aug 2015 00:24:26 -0400 Received: from 172.24.1.47 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BLW04311; Sat, 29 Aug 2015 12:23:23 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Sat, 29 Aug 2015 12:23:12 +0800 From: Wang Nan <wangnan0@huawei.com> To: <acme@redhat.com>, <mingo@kernel.org>, <ast@plumgrid.com> CC: <linux-kernel@vger.kernel.org>, <lizefan@huawei.com>, <pi3orama@163.com>, Wang Nan <wangnan0@huawei.com>, Brendan Gregg <brendan.d.gregg@gmail.com>, Daniel Borkmann <daniel@iogearbox.net>, David Ahern <dsahern@gmail.com>, "He Kuang" <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>, Kaixu Xia <xiakaixu@huawei.com>, Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>, Namhyung Kim <namhyung@kernel.org>, Paul Mackerras <paulus@samba.org>, Peter Zijlstra <a.p.zijlstra@chello.nl> Subject: [PATCH 20/31] perf probe: Reset args and nargs for probe_trace_event when failure Date: Sat, 29 Aug 2015 04:21:54 +0000 Message-ID: <1440822125-52691-21-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1440822125-52691-1-git-send-email-wangnan0@huawei.com> References: <1440822125-52691-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 X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.55E133BB.007E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ebc320d673316512ff37af1cc525f2d4 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.215.41 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 29c43c068..5ab9cd6 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1228,6 +1228,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 further, 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/1436445342-1402-31-git-send-email-wangnan0@huawei.com --- tools/perf/util/probe-finder.c | 4 ++++ 1 file changed, 4 insertions(+)