From patchwork Sun Sep 6 07:13:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 53192 Return-Path: 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 A83AB22B05 for ; Sun, 6 Sep 2015 07:20:02 +0000 (UTC) Received: by lagj9 with SMTP id j9sf19074536lag.0 for ; Sun, 06 Sep 2015 00:20:01 -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=azd6dboaprx4dFv0uS74o1sTrKIjqr9rW54YMGVTFRtg4ugmu13ejza9TK15Lz+r/s LWV2gpusySy/kZ9+zxrRV7p7+kl1jZOxyBqp+KKbhS8yjHyOJ483HXyPeAXHJU1+HCmC PDTQx3KtZI2mu3pCZoQaJHLr5JsAPbVla1wTauR+DaXVaOpq8LESwmZPX7SVn7mQQFuR 5v+lWkvWHTC6bEz5eYHfIBGquGHouJnb6SsRCAm9miyFTMMgbSJzEmwsOeWti3Dxu+JS 6so5Mo1gMN155NCYeibMgJwue0cibf5dipRGFuC7R7fZNiuCDsK2r1p0z4uRA1b0j2/6 XpJQ== X-Gm-Message-State: ALoCoQleGasM3R0R+s9rJN248Oy5Ej1Wnzz1BpVmz5225TKcfhAjFuRQoofAUGaRh6G/VQlmjaIp X-Received: by 10.112.132.105 with SMTP id ot9mr3252613lbb.21.1441524001282; Sun, 06 Sep 2015 00:20:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.2 with SMTP id i2ls470032laf.100.gmail; Sun, 06 Sep 2015 00:20:01 -0700 (PDT) X-Received: by 10.112.14.8 with SMTP id l8mr11700878lbc.68.1441524001105; Sun, 06 Sep 2015 00:20:01 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id r10si7214027lar.147.2015.09.06.00.20.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Sep 2015 00:20:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by laeb10 with SMTP id b10so35929120lae.1 for ; Sun, 06 Sep 2015 00:20:01 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr11673070laf.112.1441524000953; Sun, 06 Sep 2015 00:20:00 -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.164.42 with SMTP id yn10csp845054lbb; Sun, 6 Sep 2015 00:19:59 -0700 (PDT) X-Received: by 10.68.197.65 with SMTP id is1mr30259773pbc.109.1441523999831; Sun, 06 Sep 2015 00:19:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id vr1si13819013pab.21.2015.09.06.00.19.58; Sun, 06 Sep 2015 00:19:59 -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 S1753321AbbIFHT5 (ORCPT + 28 others); Sun, 6 Sep 2015 03:19:57 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:54448 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751317AbbIFHOl (ORCPT ); Sun, 6 Sep 2015 03:14:41 -0400 Received: from 172.24.1.49 (EHLO SZXEML423-HUB.china.huawei.com) ([172.24.1.49]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BMJ96282; Sun, 06 Sep 2015 15:14:20 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by SZXEML423-HUB.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.235.1; Sun, 6 Sep 2015 15:14:10 +0800 From: Wang Nan To: , , , CC: , , , , , , , , , , , Subject: [PATCH 17/27] perf probe: Reset args and nargs for probe_trace_event when failure Date: Sun, 6 Sep 2015 07:13:33 +0000 Message-ID: <1441523623-152703-18-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1441523623-152703-1-git-send-email-wangnan0@huawei.com> References: <1441523623-152703-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.55EBE7CD.003A, 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: 5f46df82e6b1f2475648e90129030ebf Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: 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.44 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: , List-Help: , List-Archive: List-Unsubscribe: , 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 Cc: Alexei Starovoitov Cc: Brendan Gregg Cc: Daniel Borkmann Cc: David Ahern Cc: He Kuang Cc: Jiri Olsa Cc: Kaixu Xia Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Zefan Li Cc: pi3orama@163.com Cc: Arnaldo Carvalho de Melo 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(+) 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; }