diff options
author | Arnaldo Carvalho de Melo | 2018-12-06 15:02:57 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-02-12 19:47:11 +0100 |
commit | 4d54106091517b73e01204bfab981ed77d9d63a8 (patch) | |
tree | 2616eb9120643480450eafc1ea86e4d947fd9523 /fs/btrfs/inode.c | |
parent | perf dso: Fix unchecked usage of strncpy() (diff) | |
download | kernel-qcow2-linux-4d54106091517b73e01204bfab981ed77d9d63a8.tar.gz kernel-qcow2-linux-4d54106091517b73e01204bfab981ed77d9d63a8.tar.xz kernel-qcow2-linux-4d54106091517b73e01204bfab981ed77d9d63a8.zip |
perf header: Fix unchecked usage of strncpy()
[ Upstream commit 7572588085a13d5db02bf159542189f52fdb507e ]
The strncpy() function may leave the destination string buffer
unterminated, better use strlcpy() that we have a __weak fallback
implementation for systems without it.
This fixes this warning on an Alpine Linux Edge system with gcc 8.2:
util/header.c: In function 'perf_event__synthesize_event_update_unit':
util/header.c:3586:2: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
strncpy(ev->data, evsel->unit, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/header.c:3579:16: note: length computed here
size_t size = strlen(evsel->unit);
^~~~~~~~~~~~~~~~~~~
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: a6e5281780d1 ("perf tools: Add event_update event unit type")
Link: https://lkml.kernel.org/n/tip-fiikh5nay70bv4zskw2aa858@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/btrfs/inode.c')
0 files changed, 0 insertions, 0 deletions