]> git.baikalelectronics.ru Git - kernel.git/commit
cpupower: remove stringop-truncation waring
authorAnders Roxell <anders.roxell@linaro.org>
Tue, 28 Aug 2018 09:31:18 +0000 (11:31 +0200)
committerShuah Khan (Samsung OSG) <shuah@kernel.org>
Tue, 28 Aug 2018 21:46:12 +0000 (15:46 -0600)
commit3927d5ba6b2bd8dd12db9a349426761b8e6b75f9
treef0346385656974af03207e63c00b0a58e0331031
parentf030a7bb7b1f7de16c1c716a587185e209e25800
cpupower: remove stringop-truncation waring

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: 36675b894d54 ("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>
tools/power/cpupower/bench/parse.c