|
|
|
|
|
|
|
|
|
|
xen-devel
[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 bounds
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-devel] [PATCH] libxc/xc_pm.c: fix an off-by-one error in xc_pm.c,
Isaku Yamahata <=
|
|
|
|
|