aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Landden <shawn@git.icu>2019-05-18 15:32:38 -0300
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:39 -0400
commit21b52a0db8e1d339b8115f37e7790f3f6620c431 (patch)
treef77de732c8d800486ced3dcd1b78b04b40efaf22
parentf969fd1c76575f22a6a3a393c81dfebe6a6669a3 (diff)
downloadlinux-yocto-21b52a0db8e1d339b8115f37e7790f3f6620c431.tar.gz
linux-yocto-21b52a0db8e1d339b8115f37e7790f3f6620c431.tar.bz2
linux-yocto-21b52a0db8e1d339b8115f37e7790f3f6620c431.zip
perf data: Fix 'strncat may truncate' build failure with recent gcc
commit 97acec7df172cd1e450f81f5e293c0aa145a2797 upstream. This strncat() is safe because the buffer was allocated with zalloc(), however gcc doesn't know that. Since the string always has 4 non-null bytes, just use memcpy() here. CC /home/shawn/linux/tools/perf/util/data-convert-bt.o In file included from /usr/include/string.h:494, from /home/shawn/linux/tools/lib/traceevent/event-parse.h:27, from util/data-convert-bt.c:22: In function ‘strncat’, inlined from ‘string_set_value’ at util/data-convert-bt.c:274:4: /usr/include/powerpc64le-linux-gnu/bits/string_fortified.h:136:10: error: ‘__builtin_strncat’ output may be truncated copying 4 bytes from a string of length 4 [-Werror=stringop-truncation] 136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Shawn Landden <shawn@git.icu> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> LPU-Reference: 20190518183238.10954-1-shawn@git.icu Link: https://lkml.kernel.org/n/tip-289f1jice17ta7tr3tstm9jm@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--tools/perf/util/data-convert-bt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 5744c12641a5..2d5bd237b85a 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -271,7 +271,7 @@ static int string_set_value(struct bt_ctf_field *field, const char *string)
if (i > 0)
strncpy(buffer, string, i);
}
- strncat(buffer + p, numstr, 4);
+ memcpy(buffer + p, numstr, 4);
p += 3;
}
}