Isaku Yamahata
2008-Dec-12 02:10 UTC
[Xen-devel] [PATCH] libxc/xc_pm.c: fix an off-by-one error in xc_pm.c
libxc/xc_pm.c: fix an off-by-one error in xc_pm.c This patch fixes the following compilation error. In fact it is an off-by-one error.> cc1: warnings being treated as errors > xc_pm.c: In function ''xc_set_cpufreq_gov'': > xc_pm.c:288: error: array subscript is above array boundsSigned-off-by: Isaku Yamahata <yamahata@valinux.co.jp> diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c --- a/tools/libxc/xc_pm.c +++ b/tools/libxc/xc_pm.c @@ -285,7 +285,7 @@ int xc_set_cpufreq_gov(int xc_handle, in sysctl.u.pm_op.cmd = SET_CPUFREQ_GOV; sysctl.u.pm_op.cpuid = cpuid; strncpy(scaling_governor, govname, CPUFREQ_NAME_LEN); - scaling_governor[CPUFREQ_NAME_LEN] = ''\0''; + scaling_governor[CPUFREQ_NAME_LEN - 1] = ''\0''; return xc_sysctl(xc_handle, &sysctl); } -- yamahata _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel