LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org> To: Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@linutronix.de> Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Clark Williams <williams@redhat.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Shawn Landden <shawn@git.icu>, Adrian Hunter <adrian.hunter@intel.com>, Jiri Olsa <jolsa@redhat.com>, Wang Nan <wangnan0@huawei.com>, Arnaldo Carvalho de Melo <acme@redhat.com> Subject: [PATCH 01/14] perf data: Fix 'strncat may truncate' build failure with recent gcc Date: Tue, 28 May 2019 14:50:07 -0300 [thread overview] Message-ID: <20190528175020.13343-2-acme@kernel.org> (raw) In-Reply-To: <20190528175020.13343-1-acme@kernel.org> From: Shawn Landden <shawn@git.icu> 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> --- tools/perf/util/data-convert-bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index e0311c9750ad..9097543a818b 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; } } -- 2.20.1
next prev parent reply other threads:[~2019-05-28 17:50 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-28 17:50 [GIT PULL] perf/urgent fixes for 5.2 Arnaldo Carvalho de Melo 2019-05-28 17:50 ` Arnaldo Carvalho de Melo [this message] 2019-05-28 17:50 ` [PATCH 02/14] perf arm64: Fix mksyscalltbl when system kernel headers are ahead of the kernel Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 03/14] tools include UAPI: Update copy of files related to new fspick, fsmount, fsconfig, fsopen, move_mount and open_tree syscalls Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 04/14] tools arch x86: Sync asm/cpufeatures.h with the with the kernel Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 05/14] tools headers UAPI: Sync linux/sched.h " Arnaldo Carvalho de Melo 2019-05-28 17:53 ` Christian Brauner 2019-05-28 17:50 ` [PATCH 06/14] tools headers UAPI: Sync linux/fs.h " Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 07/14] tools headers UAPI: Sync drm/i915_drm.h " Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 08/14] tools headers UAPI: Sync drm/drm.h " Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 09/14] perf namespace: Protect reading thread's namespace Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 10/14] perf session: Add missing swap ops for namespace events Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 11/14] perf test vmlinux-kallsyms: Ignore aliases to _etext when searching on kallsyms Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 12/14] perf machine: Read also the end of the kernel Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 13/14] perf record: Fix s390 missing module symbol and warning for non-root users Arnaldo Carvalho de Melo 2019-05-28 17:50 ` [PATCH 14/14] tools headers UAPI: Sync kvm.h headers with the kernel sources Arnaldo Carvalho de Melo 2019-05-28 21:17 ` [GIT PULL] perf/urgent fixes for 5.2 Ingo Molnar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190528175020.13343-2-acme@kernel.org \ --to=acme@kernel.org \ --cc=acme@redhat.com \ --cc=adrian.hunter@intel.com \ --cc=jolsa@kernel.org \ --cc=jolsa@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-perf-users@vger.kernel.org \ --cc=mingo@kernel.org \ --cc=namhyung@kernel.org \ --cc=shawn@git.icu \ --cc=tglx@linutronix.de \ --cc=wangnan0@huawei.com \ --cc=williams@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).