Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3783148ybb; Mon, 23 Mar 2020 07:38:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vumJeuo/y4VuS38zx9Gl4A0ZteysfFfLxMrqszjEDLyBkadk8d8a5bi1ziiQjwD2h7c5vWX X-Received: by 2002:a9d:1d43:: with SMTP id m61mr18282987otm.91.1584974318315; Mon, 23 Mar 2020 07:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584974318; cv=none; d=google.com; s=arc-20160816; b=dhs7yJdcZyySBRVTF9E3K62ZUwInbmHt2LwebnSyfrwq49U4Lq0bj4W3fQnqjPO2sC es/k1uw1CGIiCyfxIyReMLiUTLfcsymOsEQkoHud9aiIfXeb2FjB4iuyohSVdd2rMe3L Hk2Waatj7DvU+hXF2eX0vFWPYfZvlMVUAi47SiVZ/W+rRuEzOcntNpb3PlamOu7rpKHV 7mxbSS9m3wMF0EDVl8UqQtYmX2h4fWmfAMw5AUN6XyDFIaMIcaK39fgAQ0GSAMIq9c8+ 0bHHBQurE+DlCcNEF8QOQAAp4tc81tqNxTgCQ9DRzFqotOJ/lfgVLDvEAqXpIi9FS93e 5zzw== 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:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PzW9XZ2dG7NQbPkJRPiw3vOqw2mpj2opc/tY5HSMoKk=; b=dguZe9f5VCpb1rpx2z9kgHyKavFZvoY2FGjCzY589Ts8R9fvpxVnJbPmlbrmewuKyi VLIaSM/AjJsW4uG9VhSoZDwBjrZn/RYdAtnssoLHq+z5Uk5cumKNx/O52L8dywoX33zS 4tVWRepHouE+bWZU7te6zOKXq7zIX1vBGnBzAl9PYfKlLNN4AGhMdy82sywEFSQiYh7I Yh75ReRqCR24W+EVRroUZfijIuI+VQkZqmYiAeOXQYifd4TSuODRcX7CW5IYY9GendVL juh4Loo7XSYF+MhFXu0Tk2+ZpoMqhS7royUclQOiYiLtdUhfYPRXDRSFAt0Oi1P8HCct pvGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HHQBjSaM; 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=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 y7si8816783ote.303.2020.03.23.07.38.25; Mon, 23 Mar 2020 07:38:38 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HHQBjSaM; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbgCWOhr (ORCPT + 99 others); Mon, 23 Mar 2020 10:37:47 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:48382 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbgCWOhq (ORCPT ); Mon, 23 Mar 2020 10:37:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584974265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PzW9XZ2dG7NQbPkJRPiw3vOqw2mpj2opc/tY5HSMoKk=; b=HHQBjSaMJWRY8q3PeAhuF43SxvaJfrSQDFvfUO/wHLkb244qhX9wQQx9yexcJQXpvGiKRl A8Af3L2xmOchb36wOxscr5NJbBnBgW6M5bVsrCUvnPohEYuTZ3IctCeAaz/KJbi9MjitNV 0tS0ZIN5eP5R8AEAioL7TN7Sl07HB0Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-481-ZmUpf54qOTmWvCt8Xw0iAg-1; Mon, 23 Mar 2020 10:37:43 -0400 X-MC-Unique: ZmUpf54qOTmWvCt8Xw0iAg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12C17800D5A; Mon, 23 Mar 2020 14:37:42 +0000 (UTC) Received: from krava (unknown [10.40.192.119]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94AF967CF2; Mon, 23 Mar 2020 14:37:39 +0000 (UTC) Date: Mon, 23 Mar 2020 15:37:36 +0100 From: Jiri Olsa To: "Jin, Yao" 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 Subject: Re: [PATCH v2 00/14] perf: Stream comparison Message-ID: <20200323143736.GI1534489@krava> References: <20200313071118.11983-1-yao.jin@linux.intel.com> <20200323110514.GG1534489@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 23, 2020 at 09:59:13PM +0800, Jin, Yao wrote: > Hi Jiri, >=20 > 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. > >=20 > > I'm getting compilation fail: > >=20 > > BUILD: Doing 'make -j1' parallel build > > CC util/srclist.o > > util/srclist.c: In function =E2=80=98srclist__node_new=E2=80=99: > > util/srclist.c:388:35: error: =E2=80=98%s=E2=80=99 directive output = may be truncated writing up to 4095 bytes into a region of size 4091 [-We= rror=3Dformat-truncation=3D] > > 388 | snprintf(cmd, sizeof(cmd), "diff %s %s", > > | ^~ > > ...... > > 456 | ret =3D 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: =E2=80=98__builtin___snprint= f_chk=E2=80=99 output between 7 and 8197 bytes into a destination of size= 4096 > > 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_L= EVEL - 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.bui= ld:97: util/srclist.o] Error 1 > > make[3]: *** [/home/jolsa/kernel/linux-perf/tools/build/Makefile.bui= ld: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 > >=20 > >=20 > > [jolsa@krava ~]$ gcc --version > > gcc (GCC) 9.3.1 20200317 (Red Hat 9.3.1-1) > >=20 > > jirka > >=20 >=20 > Can you help to add following patch on top of the patch-set? Looks we n= eed > to check the return value of snprintf for truncation checking. yep, that helped.. I'll apply it on top for now and try to do the review soon ;-) thanks, jirka >=20 > 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; > } >=20 > - snprintf(cmd, sizeof(cmd), "diff %s %s", > - b_path, a_path); > + ret =3D snprintf(cmd, PATH_MAX, "diff %s %s", > + b_path, a_path); > + if (ret =3D=3D PATH_MAX) { > + ret =3D -1; > + goto out; > + } >=20 > pr_debug("Execute '%s'\n", cmd); >=20 > Thanks > Jin Yao >=20