Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1217037imj; Thu, 14 Feb 2019 03:08:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBKohTIWGifnt7Ncj+PfyY7CEqKie52AlJRNzq2RowPwk4cOC3+kFq3a6iEpl/LgClCWBZ X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr3473055plh.99.1550142520435; Thu, 14 Feb 2019 03:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550142520; cv=none; d=google.com; s=arc-20160816; b=FCI1eJCuVemiC8Jc4KCVQdStDd0JT5GAQFVYV0H9UsHrTIf2nW4cTJMYQ5AE/Tz7zs qqttQ4FIma/nJ8WFsluMslMgiDCjlpEw7Mv639Sm+RItiuCXQ4aCZofaVFPVDuY+IT9J qlmz16r+bn3W4p+NH54yZgEtwVWIsPR1+GcX8B+mODeFlkEm/93Z5CKT36mYG076VQ8m f2II1sfeTrR1s0zWj3yKOIRcvZP2wSKP8lnk1MudnpwLkV0nW5RiJRnl+DpTjMmjf5C/ xVsVoe9iqK7m/1aRysddmXkRGz4J4ZHTX3baUL5xz42GeK5Y0IGlKgHAFsnP+pjBPMw9 Nncw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=kdNPWkENdyVwHFX6470u3N2eCke6NGtpl7kSFCo5kh0=; b=mVJf9hTbCPGXnBhmlnHj3tZN/oARL5yHgsCZn9e0FVZDu0LORFqe4CEwgEe/W0Nipe oBvdDNDq2PM/LPsN+KGJWzf0Tt8cqDpnwL2C5KOAQd/W6h5HfIBzGb5A35Ngys1IVEUE kw/iBjnvfm9iF/14hkI1njMVAIoRyMxaCBPtPmVduEptewnFagMDJljXcWdHn+zeuU0c H7tdNgFnUHC/ifSVba5g0UBmMSrGJAbtPB0tnFWxfB2PI/DgSlNl1h+SyOlO7KIxVLDu 2EPKAE05I4tmFEOPO8qCMtkauqFTi8izlNNuXQgw8mJzmpJ/yOwK6UubsNdlJZs1OMir 1BYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RJLtWSJx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si2266745pfb.166.2019.02.14.03.08.22; Thu, 14 Feb 2019 03:08:40 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RJLtWSJx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730298AbfBNFYC (ORCPT + 99 others); Thu, 14 Feb 2019 00:24:02 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:38988 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfBNFYC (ORCPT ); Thu, 14 Feb 2019 00:24:02 -0500 Received: by mail-yw1-f66.google.com with SMTP id k188so1869110ywa.6 for ; Wed, 13 Feb 2019 21:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=kdNPWkENdyVwHFX6470u3N2eCke6NGtpl7kSFCo5kh0=; b=RJLtWSJxbBqplzUcVnHmTz6IHOQ3IiO0XtxZWxWfC9C8GUqVUIVpfXfEQl9ow3f2Nu rk8dDEjSYN2kgtHIovcMOs1T7PwbUpl1bVcJ+Gj5GeFMoIiLSl1QUFGvb9zGRQNxBCbH rBgry4hQfIin+gd1NzQRw8l+enWhMNAD2If1Z/mMZjH80iPmJrl6lWFaYmnTQjgCAgPM Vd4yl100Yf4Ijgk9yLwwig8w01KdLYJv7++1SwhkPxBUt81RBijiZzJJUvLheOOulCwm jcYUlMnO7G3DmOwozQdOvS9lmuum4gPlcBW3EbLAA1lzZxyTZwOx/0+Na3zn/jm5hQbw 9M5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=kdNPWkENdyVwHFX6470u3N2eCke6NGtpl7kSFCo5kh0=; b=RBc0trzZtyqTi4ZnxkcRuCsDYPHnby3z6wVbZpHECguI6rHpG+GFuEvkJHC4H8PeI2 RyXQlFQ0vD7W86Bl3Nr3VlUHGvT1OTxV2WGuNL/+R2O46SndkbAt3j0etX3IWh7YeuGQ 2QDG482DX0B+kZr5zB2H/Z5ZEcm61W2UH3onKYybYdYmF7ZH4BfaaRvVwn1mcGOK7G8T qlxRiVGwp7CsVcLrJm7Fdi+7LjBKzigYl3pPwS0TuLQxU7FPPo02/uSF/mujpm/tczct VRRNMB+WEBctyqcWNZy8Uxl/raQ6BZ6zfyw0lkeBCqAK86Ok4A4MgCOqExxqwXUt7+ko 0luA== X-Gm-Message-State: AHQUAuYRjW/IKfB3ose4GSH6iX7spUY3RStt5f58Rod+ZckDcv9/ihnT on8XN52/B4OQeIz7FPSgT8I= X-Received: by 2002:a81:1b44:: with SMTP id b65mr1483255ywb.393.1550121841447; Wed, 13 Feb 2019 21:24:01 -0800 (PST) Received: from localhost.localdomain ([191.101.9.198]) by smtp.gmail.com with ESMTPSA id q11sm675909ywl.99.2019.02.13.21.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 21:24:01 -0800 (PST) From: Bo YU To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com Cc: Bo Yu , jolsa@redhat.com, namhyung@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf trace: Fix potential USE_AFTER_FREE problem Date: Thu, 14 Feb 2019 00:23:56 -0500 Message-Id: <20190214052356.26884-1-tsu.yubo@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bo Yu There is a freed pointer "evsel", so fix it. Detected by CoverityScan, CID#1442595("Memory-illegalaccesses (USE_AFTER_FREE)") Fixes: 6ab3bc240ade4("perf trace: Support multiple "vfs_getname" probes") Signed-off-by: Bo Yu --- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index b36061cd1ab8..4036b20a1067 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2515,7 +2515,7 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) { bool found = false; - struct perf_evsel *evsel, *tmp; + struct perf_evsel *evsel = NULL, *tmp; struct parse_events_error err = { .idx = 0, }; int ret = parse_events(evlist, "probe:vfs_getname*", &err); -- 2.11.0