[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pnrerwh3.fsf@linux.intel.com>
Date: Tue, 26 Feb 2019 14:55:20 -0800
From: Andi Kleen <ak@...ux.intel.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Andi Kleen <andi@...stfloor.org>, acme@...nel.org,
jolsa@...nel.org, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, eranian@...gle.com
Subject: Re: Support sample context in perf report
Jiri Olsa <jolsa@...hat.com> writes:
>
> im still getting compile error the new branch:
>
> CC ui/browsers/hists.o
> ui/browsers/hists.c: In function ‘perf_evsel__hists_browse’:
> ui/browsers/hists.c:2567:8: error: ‘%s’ directive output may be truncated writing up to 63 bytes into a region of size between 28 and 91 [-Werror=format-truncation=]
> n += snprintf(script_opt + n, len - n, " --time %s,%s", start, end);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from /usr/include/stdio.h:862,
> from ui/browsers/hists.c:5:
> /usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 10 and 136 bytes into a destination of size 100
> return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> __bos (__s), __fmt, __va_arg_pack ());
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> mv: cannot stat 'ui/browsers/.hists.o.tmp': No such file or directory
I tested with gcc 8 and it built on a opensuse leap system.
Of course you never know where you end up with the gcc -Werror
russian roulette. I don't think any of those can really overflow,
it's all false positives. This one is particularly annoying
because the compiler seems to assume that every char[] variable
is filled up to the maximum, which is flat out wrong.
Anyways this patch should help.
-Andi
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index e35b274ee863..8ca988506388 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2554,7 +2554,7 @@ do_run_script(struct hist_browser *browser __maybe_unused,
}
if (act->time) {
- char start[64], end[64];
+ char start[22], end[22];
unsigned long starttime = act->time;
unsigned long endtime = act->time + symbol_conf.time_quantum;
Powered by blists - more mailing lists