Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3746724ybb; Mon, 23 Mar 2020 07:00:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs2ExrqPwlc6Bm3im91Q4Jid7cP2xK86VNCxlC6G7BXj+Q0sQmDj1fE3WCScDV5Sh66YMkA X-Received: by 2002:a9d:23a6:: with SMTP id t35mr6080948otb.154.1584972009372; Mon, 23 Mar 2020 07:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584972009; cv=none; d=google.com; s=arc-20160816; b=k8TGe0sFJl3YerLeQhedR0rQJaQPJISvRwblz2X2Y7+3Noyl4IqOY4fc36bin3hXIo WIb2nmziMEh3R5ne3URMZVnGUrQZ9+eotUvmO0tIjxH0rHnqX+/lZBBChmXiWYq/cBRB 1KOZkuJ84NnIk04xseZfCcd7HSu9ZRTtPSjBTccRdFSuMrvN4pKZ6+p9f9wiQ+FPpXPP SPuBr7RBbpm8bZ3Ys9It2BlI+aG/FRuVrTLRr2gH8Ggl2WfcCcytkiG5c86qTOpb2V/o qgz+CiLHOvpYzJDdhq8pBx51f0h/UHsEC2lKeN7FDeGzlL1wtJdG+0SIAPidsRecBP/4 l9Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=MQ7ZvG2SDGE61VNtbCJSB+SLdDuD4I3zXd23zpoU1eE=; b=ERNbuQYFSqbwiiUf/dClS2mT+/UsHULQZqmJsX7X2FW0xobyW2eXAkOSQ0RofaD3GR HYwMZ1+WIFpLKNLBmAeEPbPl/1aWWrY/u+ivhcMl799+frQRiklFW4sh9+EAhPU8B3nS S9LqHeZZOwzvA5mQklYsi+1bF4nGgEp3CiOw3LCgDQZ8EPXDOzIGoKu37mvKrBWROXEB KVtdMyZOVPjK91BEBgUJMJO+XgqKzQfUrDIHV9RNxR1qB6hoi8xj1XiYQ4asKORdjoTa 2xG8/xxO3cUHeMtO/mYM6gT1x4+EcWVanvz9VAEw19Vpr9p+NS7v8md4Nlmy3gA6BIBy +HNg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a12si1126123otr.321.2020.03.23.06.59.55; Mon, 23 Mar 2020 07:00:09 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728575AbgCWN7S (ORCPT + 99 others); Mon, 23 Mar 2020 09:59:18 -0400 Received: from mga11.intel.com ([192.55.52.93]:32719 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728530AbgCWN7S (ORCPT ); Mon, 23 Mar 2020 09:59:18 -0400 IronPort-SDR: s5mHNkrDBxv1gRMLe3MYhrgqRx60yGeOUk4Z89NuyHexrcg37Ksq2HgTFU3BoBXbm7UE+I04F1 ofE8IqM5QmXw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 06:59:18 -0700 IronPort-SDR: DqH60UWVJ8o+GzONqrr9LzVitrkLS8sMk0GSBjgE6Tqd5YokA3vDXTEPUpQm7u96p0CfC71lKI Krzpd3KU3GAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,296,1580803200"; d="scan'208";a="357101009" Received: from yjin15-mobl1.ccr.corp.intel.com (HELO [10.254.213.220]) ([10.254.213.220]) by fmsmga001.fm.intel.com with ESMTP; 23 Mar 2020 06:59:14 -0700 Subject: Re: [PATCH v2 00/14] perf: Stream comparison To: Jiri Olsa Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com References: <20200313071118.11983-1-yao.jin@linux.intel.com> <20200323110514.GG1534489@krava> From: "Jin, Yao" Message-ID: Date: Mon, 23 Mar 2020 21:59:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200323110514.GG1534489@krava> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On 3/23/2020 7:05 PM, Jiri Olsa wrote: > On Fri, Mar 13, 2020 at 03:11:04PM +0800, Jin Yao wrote: >> Sometimes, a small change in a hot function reducing the cycles of >> this function, but the overall workload doesn't get faster. It is >> interesting where the cycles are moved to. > > I'm getting compilation fail: > > BUILD: Doing 'make -j1' parallel build > CC util/srclist.o > util/srclist.c: In function ‘srclist__node_new’: > util/srclist.c:388:35: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4091 [-Werror=format-truncation=] > 388 | snprintf(cmd, sizeof(cmd), "diff %s %s", > | ^~ > ...... > 456 | ret = init_src_info(b_path, a_path, rel_path, &node->info); > | ~~~~~~ > In file included from /usr/include/stdio.h:867, > from util/srclist.c:8: > /usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 7 and 8197 bytes into a destination of size 4096 > 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 68 | __bos (__s), __fmt, __va_arg_pack ()); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > mv: cannot stat 'util/.srclist.o.tmp': No such file or directory > make[4]: *** [/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:97: util/srclist.o] Error 1 > make[3]: *** [/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:139: util] Error 2 > make[2]: *** [Makefile.perf:617: perf-in.o] Error 2 > make[1]: *** [Makefile.perf:225: sub-make] Error 2 > make: *** [Makefile:70: all] Error 2 > > > [jolsa@krava ~]$ gcc --version > gcc (GCC) 9.3.1 20200317 (Red Hat 9.3.1-1) > > jirka > Can you help to add following patch on top of the patch-set? Looks we need to check the return value of snprintf for truncation checking. jinyao@kbl:~/kbl-ws/perf-dev/lck-7589/acme/tools/perf$ git diff diff --git a/tools/perf/util/srclist.c b/tools/perf/util/srclist.c index 8060e4855d11..51ca69eaa9fd 100644 --- a/tools/perf/util/srclist.c +++ b/tools/perf/util/srclist.c @@ -385,8 +385,12 @@ static int src_info__create_line_mapping(struct src_info *info, char *b_path, goto out; } - snprintf(cmd, sizeof(cmd), "diff %s %s", - b_path, a_path); + ret = snprintf(cmd, PATH_MAX, "diff %s %s", + b_path, a_path); + if (ret == PATH_MAX) { + ret = -1; + goto out; + } pr_debug("Execute '%s'\n", cmd); Thanks Jin Yao