diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2018-08-28 11:31:18 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-02-11 17:53:16 +0000 |
commit | 43977b8828f6634dbcd2e24568557f81b30bebd2 (patch) | |
tree | acf47566dbdd82241003ad934e0fc067e902214a /tools | |
parent | e4d314cbe55e5a376a8ec2e356108b6c4eda8c55 (diff) | |
download | linux-stable-43977b8828f6634dbcd2e24568557f81b30bebd2.tar.gz linux-stable-43977b8828f6634dbcd2e24568557f81b30bebd2.tar.bz2 linux-stable-43977b8828f6634dbcd2e24568557f81b30bebd2.zip |
cpupower: remove stringop-truncation waring
commit 8a7e2d2ea080d10a189a1d611344b0330468ebc3 upstream.
The strncpy doesn't null terminate the string because the size is too
short by one byte.
parse.c: In function ‘prepare_default_config’:
parse.c:148:2: warning: ‘strncpy’ output truncated before terminating
nul copying 8 bytes from a string of the same length
[-Wstringop-truncation]
strncpy(config->governor, "ondemand", 8);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The normal method of passing the length of the destination buffer works
correctly here.
Fixes: 7fe2f6399a84 ("cpupowerutils - cpufrequtils extended with quite some features")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/cpupower/bench/parse.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c index 543bba14ae2c..bdbe1da587af 100644 --- a/tools/power/cpupower/bench/parse.c +++ b/tools/power/cpupower/bench/parse.c @@ -135,7 +135,7 @@ struct config *prepare_default_config() config->cpu = 0; config->prio = SCHED_HIGH; config->verbose = 0; - strncpy(config->governor, "ondemand", 8); + strncpy(config->governor, "ondemand", sizeof(config->governor)); config->output = stdout; |