Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1614231imj; Thu, 14 Feb 2019 09:10:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IZI6rUS3oNws7dyTEzdFK2qzrpCCx+dO0KcVhTME7OMqY3ykkebULZ0hwMF5ck+Kkdnbbmc X-Received: by 2002:a17:902:9691:: with SMTP id n17mr5378286plp.9.1550164259086; Thu, 14 Feb 2019 09:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550164259; cv=none; d=google.com; s=arc-20160816; b=TOue7Xdu4An1I113GjsdlRcY3bRWdM5EKKaE20yKdFzDOQy17R1G2MYyW2olp9gC/9 H+oTGNhsgbdeEXHuLV7tDbVRm6VLtT6RF0jH+0OusdXkKWGMm4GC8YFyZY1cw8ocXs3Q k4CVircdxgYPC5d2xNOsBDplFta8AttDfK1uXlv8MGBKAyER6n7yFGkRznHQ8E+sqQ52 n6ii9JdVtvijPGyP0Q6kLIFB/HoC8yQCqWWPgseK+ZboMsBi/15XgTpuYP76g7dTZa+S zfeOU/dBSoZYfIX3X3l61bH12CO6EtdLXNr0C+oKwEWt8YQH7FYFmki4I/LEY1MFBXkU DNDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=JBi0HVc9GAkJ3GPg7WFKs/40/xMWqfqXuVk6Sn6Tlok=; b=FxNI48n2Q/0OwOq4bInmksoNXRDrxy44DfkNdOxgrUTOXa+/9IYRG+8ys0KpqnjygA qiIMZVNjVJc+uUfBdMxqARTsYUhU6FXS7hFH54dzLP9eQY/tKNiBtOam+k93N2+lQ5cX i0ThRuQvsrs184ya0EA0jd9IgBrhUGwAVXGH5Eoe8AGrLe9IWeRprDeMHKY+1326Qrfu nNdbRbbmvn9hZFPAtK+W+lmBn8n2Gd5ZCJVwk5U1F//OoJ0+II9PnBtXOHsLBjvDlRcm GNY5IpvweDaMRo8IzRRPkO2UEq9X5VcHfz9h0cfIZX8hqnE0DPe9KtrWFuB/eg9gTADr o8dA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si2850789plp.269.2019.02.14.09.10.42; Thu, 14 Feb 2019 09:10:59 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394671AbfBNIeQ (ORCPT + 99 others); Thu, 14 Feb 2019 03:34:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25240 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394645AbfBNIeP (ORCPT ); Thu, 14 Feb 2019 03:34:15 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9022A0B42; Thu, 14 Feb 2019 08:34:15 +0000 (UTC) Received: from krava (unknown [10.43.17.161]) by smtp.corp.redhat.com (Postfix) with SMTP id E92B154500; Thu, 14 Feb 2019 08:34:12 +0000 (UTC) Date: Thu, 14 Feb 2019 09:34:11 +0100 From: Jiri Olsa To: Bo YU Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf trace: Fix potential USE_AFTER_FREE problem Message-ID: <20190214083411.GA25842@krava> References: <20190214052356.26884-1-tsu.yubo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190214052356.26884-1-tsu.yubo@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 14 Feb 2019 08:34:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 14, 2019 at 12:23:56AM -0500, Bo YU wrote: > 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; hum, I can't see how this change could matter, could you pelase explain? jirka > struct parse_events_error err = { .idx = 0, }; > int ret = parse_events(evlist, "probe:vfs_getname*", &err); > > -- > 2.11.0 >