Message ID | 1444292984-13135-13-git-send-email-wangnan0@huawei.com |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBD2YXXXCQEBBBSWV3CYAKGQEQWDRBVA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 01BA922FF8 for <linaro@patches.linaro.org>; Thu, 8 Oct 2015 08:35:23 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf6761283wic.3 for <linaro@patches.linaro.org>; Thu, 08 Oct 2015 01:35:22 -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=dNlIe/nHwCohi+ooAc8fg39k5/T53UtY7ROiGEbA1umzNr2YFM5GVskTqbKpdYhCu9 DMkLHzPsIDJRGFJlkVQ7RDMpz05QYpBkNXQpRevtq6iePqq9ZtHO4RrkBV/2dTG71ikz tZkNHgFN4zpojwm+V/IxJh0dF5vw/SvqiepQT56AigZmJxayCrzFNbQ11ynmt+xUsRho h1uShcdgSgHqaxWh3eiCiNI9CVP6PfCjNPrvVDUh0Hze9aNU429MspLqrBz3/6fQu9sa cewEaR8hGO3cuEe1PCwnjtGsmWD7IYdBnU1Csx9JZM1gvcvDR+AmAN/PM0UtybFIgEVa 8fYg== X-Gm-Message-State: ALoCoQldSbOvvaYE3g3CYwPxCsFxAFUm6hOl3qwTZNgFNY63mxMdXq+vjbjyWTB/u7OOpLb5RsRK X-Received: by 10.180.105.98 with SMTP id gl2mr439472wib.0.1444293322263; Thu, 08 Oct 2015 01:35:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.150.209 with SMTP id y200ls142643lfd.17.gmail; Thu, 08 Oct 2015 01:35:22 -0700 (PDT) X-Received: by 10.25.206.17 with SMTP id e17mr1918103lfg.57.1444293322082; Thu, 08 Oct 2015 01:35:22 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id th8si28781069lbb.153.2015.10.08.01.35.22 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Oct 2015 01:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbwt4 with SMTP id wt4so38656992lbb.1 for <patchwork-forward@linaro.org>; Thu, 08 Oct 2015 01:35:22 -0700 (PDT) X-Received: by 10.25.77.133 with SMTP id a127mr1930103lfb.19.1444293321933; Thu, 08 Oct 2015 01:35:21 -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 w3csp439580lbq; Thu, 8 Oct 2015 01:35:20 -0700 (PDT) X-Received: by 10.66.100.166 with SMTP id ez6mr6043378pab.78.1444293320588; Thu, 08 Oct 2015 01:35:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ye5si64758663pab.0.2015.10.08.01.35.20; Thu, 08 Oct 2015 01:35:20 -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 S1754575AbbJHIfS (ORCPT <rfc822;pingbo.wen@linaro.org> + 30 others); Thu, 8 Oct 2015 04:35:18 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:53066 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754060AbbJHIfL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Oct 2015 04:35:11 -0400 Received: from 172.24.1.48 (EHLO szxeml427-hub.china.huawei.com) ([172.24.1.48]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CTW16129; Thu, 08 Oct 2015 16:29:59 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml427-hub.china.huawei.com (10.82.67.182) with Microsoft SMTP Server id 14.3.235.1; Thu, 8 Oct 2015 16:29:35 +0800 From: Wang Nan <wangnan0@huawei.com> To: <acme@redhat.com> CC: <linux-kernel@vger.kernel.org>, <pi3orama@163.com>, <lizefan@huawei.com>, Wang Nan <wangnan0@huawei.com>, Alexei Starovoitov <ast@plumgrid.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 12/22] perf probe: Reset args and nargs for probe_trace_event when failure Date: Thu, 8 Oct 2015 08:29:34 +0000 Message-ID: <1444292984-13135-13-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1444292984-13135-1-git-send-email-wangnan0@huawei.com> References: <1444292984-13135-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.182 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(+)