Skip to content

Commit d8d005b

Browse files
committed
tools/power turbostat: Fix gcc build warnings
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 <[email protected]>
1 parent 081c543 commit d8d005b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5325,9 +5325,9 @@ int add_counter(unsigned int msr_num, char *path, char *name,
53255325
}
53265326

53275327
msrp->msr_num = msr_num;
5328-
strncpy(msrp->name, name, NAME_BYTES);
5328+
strncpy(msrp->name, name, NAME_BYTES - 1);
53295329
if (path)
5330-
strncpy(msrp->path, path, PATH_BYTES);
5330+
strncpy(msrp->path, path, PATH_BYTES - 1);
53315331
msrp->width = width;
53325332
msrp->type = type;
53335333
msrp->format = format;

0 commit comments

Comments
 (0)