summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2020-03-20 01:33:12 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-08 10:08:39 +0300
commit0ba0ce3cbb866e1b8fe688a89a73a6d3861490a5 (patch)
tree5e3f7cc33104567f0eaae2200cad0be95849ecc7 /tools
parent7ebc1e53a46b5256438988bfec15a50b941b04f1 (diff)
downloadlinux-0ba0ce3cbb866e1b8fe688a89a73a6d3861490a5.tar.xz
tools/power turbostat: Fix gcc build warnings
[ Upstream commit d8d005ba6afa502ca37ced5782f672c4d2fc1515 ] Warning: ‘__builtin_strncpy’ specified bound 20 equals destination size [-Wstringop-truncation] reduce param to strncpy, to guarantee that a null byte is always copied into destination buffer. Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 5d0fddda842c..78507cd479bb 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5323,9 +5323,9 @@ int add_counter(unsigned int msr_num, char *path, char *name,
}
msrp->msr_num = msr_num;
- strncpy(msrp->name, name, NAME_BYTES);
+ strncpy(msrp->name, name, NAME_BYTES - 1);
if (path)
- strncpy(msrp->path, path, PATH_BYTES);
+ strncpy(msrp->path, path, PATH_BYTES - 1);
msrp->width = width;
msrp->type = type;
msrp->format = format;