]> xenbits.xensource.com Git - xen.git/commit
tools/libxc: fix strncpy size
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Thu, 5 Apr 2018 01:50:49 +0000 (03:50 +0200)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 12 Jun 2020 16:01:39 +0000 (17:01 +0100)
commit9737f89b076ae4d05e6f974a7c21aced4459966e
tree54009223bfa77f9ad255292a4c640a3b5566b39e
parent1dd64783024c5c9e600c3d33393b795c68a46f65
tools/libxc: fix strncpy size

gcc-8 warns about possible truncation of trailing '\0'.
Final character is overridden by '\0' anyway, so don't bother to copy
it.

This fixes compile failure:

    xc_pm.c: In function 'xc_set_cpufreq_gov':
    xc_pm.c:308:5: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
         strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-Acked-by: Juergen Gross <jgross@suse.com>
(cherry picked from commit fa7789ef18bd2e716997937af71b2e4b5b00a159)
tools/libxc/xc_pm.c