mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-29 17:33:09 +00:00
* src/xen_internal.c: rewrite of range check in credit scheduler
initially suggested by Atsushi SAKAI Daniel
This commit is contained in:
parent
ba8648896f
commit
30c10b82c1
@ -1,3 +1,8 @@
|
|||||||
|
Thu Jul 19 15:38:44 CEST 2007 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
|
* src/xen_internal.c: rewrite of range check in credit scheduler
|
||||||
|
initially suggested by Atsushi SAKAI
|
||||||
|
|
||||||
Wed Jul 18 17:45:08 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
Wed Jul 18 17:45:08 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/qemu_conf.c: Remove double free of XML property upon
|
* src/qemu_conf.c: Remove double free of XML property upon
|
||||||
|
@ -1170,6 +1170,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
|||||||
virSchedParameterPtr params, int nparams)
|
virSchedParameterPtr params, int nparams)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
unsigned int val;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL)) {
|
if ((domain == NULL) || (domain->conn == NULL)) {
|
||||||
@ -1237,11 +1238,25 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
|||||||
for (i = 0; i < nparams; i++) {
|
for (i = 0; i < nparams; i++) {
|
||||||
if (STREQ (params[i].field, str_weight) &&
|
if (STREQ (params[i].field, str_weight) &&
|
||||||
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
|
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
|
||||||
op_dom.u.getschedinfo.u.credit.weight = params[i].value.ui;
|
val = params[i].value.ui;
|
||||||
|
if ((val < 1) || (val > USHRT_MAX)) {
|
||||||
|
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||||
|
_("Credit scheduler weight parameter (%d) is out of range (1-65535)"),
|
||||||
|
val);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
op_dom.u.getschedinfo.u.credit.weight = val;
|
||||||
weight_set = 1;
|
weight_set = 1;
|
||||||
} else if (STREQ (params[i].field, str_cap) &&
|
} else if (STREQ (params[i].field, str_cap) &&
|
||||||
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
|
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
|
||||||
op_dom.u.getschedinfo.u.credit.cap = params[i].value.ui;
|
val = params[i].value.ui;
|
||||||
|
if (val > USHRT_MAX) {
|
||||||
|
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||||
|
_("Credit scheduler cap parameter (%d) is out of range (0-65535)"),
|
||||||
|
val);
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
op_dom.u.getschedinfo.u.credit.cap = val;
|
||||||
cap_set = 1;
|
cap_set = 1;
|
||||||
} else {
|
} else {
|
||||||
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
|
virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
|
||||||
|
Loading…
Reference in New Issue
Block a user