1
0
Fork 0

tools/power turbostat: Fix gcc build warnings

[ Upstream commit d8d005ba6a ]

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>
5.4-rM2-2.2.x-imx-squashed
Len Brown 2020-03-19 18:33:12 -04:00 committed by Greg Kroah-Hartman
parent 7ebc1e53a4
commit 0ba0ce3cbb
1 changed files with 2 additions and 2 deletions

View File

@ -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;