From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4E33C06510 for ; Tue, 2 Jul 2019 11:08:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8BB2A20836 for ; Tue, 2 Jul 2019 11:08:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hffcWFsz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BB2A20836 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uPKySUGbUpGZWG7OBjhIRv1UaqKBg8PhBuieYmBPZx4=; b=hffcWFszER45xd g+PvbIod9JbjUeWg24XLwHoUP2tVPF+kGo+lGcsF1QxpmJbiX0llCSJwaMqHZNNH1j71wZyzZpLUR 55NShDdPnYvNSIzhdZuvr057/Ervi4+AiJhMy67qFA18e64USn2MzYW8k4fMSyt3bQ19svwN/NTBp S+Mv+zxBCEBZ9g2K5xkmtIxXYGndRT2nc7jUGxGpvDssRtNyKh59o+fHszUVD45jHmnuv965bxRoA 1ISH+nNrZfQFZ39EiZcGugMHC5pzM9nhbxfXfskP+T68+fRcT09DWOPKfpIpR1BxF8TxAMQxoqHbn Jsxc5xYo+3nGUdMT6BHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hiGde-0008Lv-QH; Tue, 02 Jul 2019 11:07:54 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hiGda-0008LW-V6 for linux-arm-kernel@lists.infradead.org; Tue, 02 Jul 2019 11:07:52 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E79EA120D7; Tue, 2 Jul 2019 11:07:38 +0000 (UTC) Received: from krava (unknown [10.43.17.81]) by smtp.corp.redhat.com (Postfix) with SMTP id 2AB116F921; Tue, 2 Jul 2019 11:07:29 +0000 (UTC) Date: Tue, 2 Jul 2019 13:07:28 +0200 From: Jiri Olsa To: Leo Yan Subject: Re: [PATCH v1 06/11] perf hists: Smatch: Fix potential NULL pointer dereference Message-ID: <20190702110728.GA15322@krava> References: <20190702103420.27540-1-leo.yan@linaro.org> <20190702103420.27540-7-leo.yan@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190702103420.27540-7-leo.yan@linaro.org> User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 02 Jul 2019 11:07:48 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190702_040751_026279_3145272A X-CRM114-Status: GOOD ( 18.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Liu , Peter Zijlstra , Rasmus Villemoes , linux-kernel@vger.kernel.org, Jin Yao , Andi Kleen , Eric Saint-Etienne , Konstantin Khlebnikov , Ingo Molnar , Suzuki K Poulose , Arnaldo Carvalho de Melo , Alexios Zavras , Davidlohr Bueso , Namhyung Kim , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Mathieu Poirier , Thomas Richter , Adrian Hunter , Alexander Shishkin , "David S. Miller" , Changbin Du , Alexey Budankov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 02, 2019 at 06:34:15PM +0800, Leo Yan wrote: > Based on the following report from Smatch, fix the potential > NULL pointer dereference check. > > tools/perf/ui/browsers/hists.c:641 > hist_browser__run() error: we previously assumed 'hbt' could be > null (see line 625) > > tools/perf/ui/browsers/hists.c:3088 > perf_evsel__hists_browse() error: we previously assumed > 'browser->he_selection' could be null (see line 2902) > > tools/perf/ui/browsers/hists.c:3272 > perf_evsel_menu__run() error: we previously assumed 'hbt' could be > null (see line 3260) > > This patch firstly validating the pointers before access them, so can > fix potential NULL pointer dereference. > > Signed-off-by: Leo Yan > --- > tools/perf/ui/browsers/hists.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c > index 3421ecbdd3f0..2ba33040ddd8 100644 > --- a/tools/perf/ui/browsers/hists.c > +++ b/tools/perf/ui/browsers/hists.c > @@ -638,7 +638,9 @@ int hist_browser__run(struct hist_browser *browser, const char *help, > switch (key) { > case K_TIMER: { not sure this can really happen, perhaps WARN_ON_ONCE(!hbt) would be good in here jirka > u64 nr_entries; > - hbt->timer(hbt->arg); > + > + if (hbt) > + hbt->timer(hbt->arg); > > if (hist_browser__has_filter(browser) || > symbol_conf.report_hierarchy) SNIP _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel