Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3838660ybv; Mon, 10 Feb 2020 07:19:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwQ8l4ljYwkAN32SDzDuoydCs17IMHbApHBllDXchGK8Olx2/JlOeAit8FKQtfU+IOfHKPC X-Received: by 2002:a9d:7083:: with SMTP id l3mr1358817otj.193.1581347971663; Mon, 10 Feb 2020 07:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581347971; cv=none; d=google.com; s=arc-20160816; b=Cqc21vLP55kb4mvLFRcDKVmrqESGiJkZRbapHahafYQ4XyaSkg9lwOra3XTAwWLuLs b+90QuFJ1BjmICYRVbfAApj+XQz/rks7oepFUfDI+cl7kFR520t/MLkxR9zYSo2AiDWT jsMrrQfJEFci5CXn97Js1MCmBxp6CJwiOe1W5HbOIrn82O87W9fwlAPiEc9Zr9gAvqlR 6BwLY6DzemBVqXPblZSpNrPSJtJJPLbarWxGawN6O3Kwo6r2Lguiv2+3ztpagcfHrpg9 fAFwST30hZQrRWTZ8GNadxdTT21J+EyHZOWt+Y5awRt6RxCwoWYGpptrW18JONqeqf3w utCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=YkL/Zzz8Sbpu+hkQemcYp8z7AGEbyLCvoI4HhW6a6Wg=; b=nFRUxeLq0mgSoTJfdJAt/qyj5zLuj+fC7eTq45k3u551Fyc6/AsyAttD6QQMDiEKhC +k8GoEifhgwmRRfUjiP7eJh/L9kJKM/76GwT+PIxwn7/OB5fbnStpc/BIjONAwN8aB/3 TKFybaiZv7RnFpUfI+Ov2snCWRjEfMQX/MQTogez4GP6fD7QlKnGG2STcknT0XwalHBv Ip/xbdbRUhmutJrq0Gz2gEmEVL6yElBQNgHqUJaXsOQWZA2woXLUvSj+tikzePDZoRI5 1ZW6rhUdqi/c0OIyvwAdE7yJ29pYeWpmlGRMGe4+dGVsRdkwKNGN3nvS6CjMU5TM41St uCpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pvaG+hZU; 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 h28si354317otg.63.2020.02.10.07.19.18; Mon, 10 Feb 2020 07:19:31 -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=pvaG+hZU; 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 S1729144AbgBJPSD (ORCPT + 99 others); Mon, 10 Feb 2020 10:18:03 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:37301 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729013AbgBJPSD (ORCPT ); Mon, 10 Feb 2020 10:18:03 -0500 Received: by mail-qv1-f65.google.com with SMTP id m5so3329731qvv.4 for ; Mon, 10 Feb 2020 07:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YkL/Zzz8Sbpu+hkQemcYp8z7AGEbyLCvoI4HhW6a6Wg=; b=pvaG+hZU1evkJOGYKLiWWQHtdzcdA0kcoI5SmQ8lUfrTz2C/Q4JoXL81ZvKzCeu0Jc xm77gW/GbhX+ZpMg15zmvs8EcijKDd/StHpt1hNztOE8I1M7cGVMh0EfIqYgc3KOlbP6 Ftek0DtVtPXvXUyucC9BEvl/41nPtH39c4uosnGW8t5Ye/PsOmKYeKEhed70I92RpC6L tnRi/3CspHnuVG4I/9DgOsi6WSVrFW0QvMd4mix19M4iSletEysKUxR7ZAdCZDVF1+rQ +tZ2GQ/mEOb+dpUqfu/eIUkCicZkf6DdeRZ7P+VAAu5J6upnkkWmyNQ+pTKsejSZGln2 9cwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YkL/Zzz8Sbpu+hkQemcYp8z7AGEbyLCvoI4HhW6a6Wg=; b=p53Ntc2dmheaftFMuXjyTeAMGFaIfUTsLFZnV+Aj+Pscml+hXNejRBzonw1Oeyo+EP O/8gzK5+wtb7XGQPLYWh5Pk04iDQNGirOxvuGlaS5jpWh6Iwkzmamp5nxABg0E6CcyZv dhY84Jo9JOZ+047jfhc/48rP3cg2LRtuzFMZoS7cDelmBcEOQQYtY5RFvS++6355BRKu TWDbyj3SA5wsQqmrpmKVxJQ0TmkW0W+DyhHp0s4wv1umcq5d08DekEeCf5barCcca+wB 1dtB9R6qniSLNRk1gmd7cADy2Pc5VpqCqVNcw0//bxsrHoEWhqsuZhIQwOmNP4wfRFLm bAzg== X-Gm-Message-State: APjAAAUbT1XUG7quCgRM7fHovaRCO+xdx3sX7KZIi73NJ60YSk5eQ8f8 RWvLVCV5wnFfBugdFr8FcRMh8piaieQ= X-Received: by 2002:ad4:518d:: with SMTP id b13mr10210271qvp.141.1581347882283; Mon, 10 Feb 2020 07:18:02 -0800 (PST) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id y26sm315215qtc.94.2020.02.10.07.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Feb 2020 07:18:01 -0800 (PST) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C822A40A7D; Mon, 10 Feb 2020 12:17:59 -0300 (-03) Date: Mon, 10 Feb 2020 12:17:59 -0300 To: Jiri Olsa Cc: Ravi Bangoria , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: Re: [PATCH 2/4] perf tools: Mark ksymbol dsos with kernel type Message-ID: <20200210151759.GB25639@kernel.org> References: <20200210143218.24948-1-jolsa@kernel.org> <20200210143218.24948-3-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210143218.24948-3-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu: > We add ksymbol map into machine->kmaps, so it needs to be > created as 'struct kmap', which is dependent on its dso > having kernel type. > > Reported-by: Ravi Bangoria > Tested-by: Ravi Bangoria > Signed-off-by: Jiri Olsa > --- > tools/perf/util/machine.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index e3e5490f6de5..0a43dc83d7b2 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine, > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr); > > if (!map) { > - map = dso__new_map(event->ksymbol.name); > - if (!map) > + struct dso *dso = dso__new(event->ksymbol.name); > + > + if (dso) { > + dso->kernel = DSO_TYPE_KERNEL; > + map = map__new2(0, dso); > + } > + > + if (!dso || !map) We leak dso if map creation fails? - Arnaldo > return -ENOMEM; > > map->start = event->ksymbol.addr; > -- > 2.24.1 > -- - Arnaldo