Coverity issues for credit2 CAP series
cover Coverity issues for credit2 CAP series
Wei Liu (2):
xen/credit2: add missing unlock
python/libxc: extend the call to get/set cap for credit2
tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++------- xen/common/sched_credit2.c | 1 + 2 files changed, 11 insertions(+), 7 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 python/libxc: extend the call to get/set cap for credit2
Commit 68817024 ("xen: credit2: allow to set and get utilization cap") added a new parameter. Implement it for the python binding as well.
Coverity-ID: 1418532
---
Cc: George Dunlap <[email protected]>
Cc: Dario Faggioli <[email protected]>
Cc: Marek Marczykowski-Górecki <[email protected]>
Compile-test only.
--- tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
tools/python/xen/lowlevel/xc/xc.c +10 -7
@@ -1348,16 +1348,19 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self, {uint32_t domid;uint16_t weight; -static char *kwd_list[] = {"domid" ,"weight" ,NULL }; -static char kwd_type[] ="I|H" ; -struct xen_domctl_sched_credit2 sdom; +uint16_t cap; +static char *kwd_list[] = {"domid" ,"weight" ,"cap" ,NULL }; +static char kwd_type[] ="I|HH" ; +struct xen_domctl_sched_credit2 sdom = { }; weight =0 ; + cap =0 ;if ( !PyArg_ParseTupleAndKeywords (args, kwds, kwd_type, kwd_list, - &domid, &weight) ) + &domid, &weight, &cap) )return NULL ; sdom.weight = weight; + sdom.cap = cap;if (xc_sched_credit2_domain_set (self->xc_handle, domid, &sdom) !=0 )return pyxc_error_to_exception (self->xc_handle);
@@ -1369,7 +1372,7 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,static PyObject *pyxc_sched_credit2_domain_get (XcObject *self,PyObject *args) {uint32_t domid; -struct xen_domctl_sched_credit2 sdom; +struct xen_domctl_sched_credit2 sdom = { };if ( !PyArg_ParseTuple (args,"I" , &domid) )return NULL ;
@@ -1377,8 +1380,8 @@ static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)if (xc_sched_credit2_domain_get (self->xc_handle, domid, &sdom) !=0 )return pyxc_error_to_exception (self->xc_handle); -return Py_BuildValue ("{s:H}" , -"weight" , sdom.weight); +return Py_BuildValue ("{s:HH}" , +"weight" ,"cap" , sdom.weight, sdom.cap); }static PyObject *pyxc_domain_setmaxmem (XcObject *self,PyObject *args)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/2 xen/credit2: add missing unlock
In reply to Wei LiuCoverity-ID: 1418531
---
Cc: George Dunlap <[email protected]>
Cc: Dario Faggioli <[email protected]>
--- xen/common/sched_credit2.c | 1 + 1 file changed, 1 insertion(+)
xen/common/sched_credit2.c +1 -0
@@ -2831,6 +2831,7 @@ csched2_dom_cntl(if ( op->u.credit2.cap >100 * sdom->nr_vcpus ) { rc = -EINVAL ; +write_unlock_irqrestore (&prv->lock, flags);break ; }
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 1/2] xen/credit2: add missing unlock
Quoted 9 lines · Wei Liu
Coverity-ID: 1418531
Signed-off-by Wei Liu <[email protected]>---
xen/common/sched_credit2.c +0
-0
xen/common/sched_credit2.c csched2_dom_cntl( · line 2835
Quoted 5 lines
xen/common/sched_credit2.c +1
-0@@ -2831,6 +2831,7 @@ csched2_dom_cntl( if ( op->u.credit2.cap > 100 * sdom->nr_vcpus ) { rc = -EINVAL; + write_unlock_irqrestore(&prv->lock, flags);
Indeed... :-/
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2
In reply to Wei LiuQuoted 6 lines · Wei Liu
Commit 68817024 ("xen: credit2: allow to set and get utilization cap")
added a new parameter. Implement it for the python binding as well.Coverity-ID: 1418532
Right. Sorry, I tend to forget about these more often that I would want to. :-(
I'll try to be more careful.
Quoted 6 lines
Signed-off-by Wei Liu <[email protected]>---
Cc: George Dunlap <[email protected]>
Cc: Dario Faggioli <[email protected]>
Cc: Marek Marczykowski-Górecki <[email protected]>
FWIW:
Regards,
Dario
Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://about.me/dario.faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/2] python/libxc: extend the call to get/set cap for credit2
In reply to Wei LiuQuoted 6 lines · Wei Liu
Commit 68817024 ("xen: credit2: allow to set and get utilization cap") added a new parameter. Implement it for the python binding as well.
Coverity-ID: 1418532
Signed-off-by Wei Liu <[email protected]>
Quoted 58 lines
---
Cc: George Dunlap <[email protected]>
Cc: Dario Faggioli <[email protected]>
Cc: Marek Marczykowski-Górecki <[email protected]>Compile-test only.
--- tools/python/xen/lowlevel/xc/xc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)tools/python/xen/lowlevel/xc/xc.c +10
-7@@ -1348,16 +1348,19 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self, {uint32_t domid;uint16_t weight; -static char *kwd_list[] = {"domid" ,"weight" ,NULL }; -static char kwd_type[] ="I|H" ; -struct xen_domctl_sched_credit2 sdom; +uint16_t cap; +static char *kwd_list[] = {"domid" ,"weight" ,"cap" ,NULL }; +static char kwd_type[] ="I|HH" ; +struct xen_domctl_sched_credit2 sdom = { }; weight =0 ; + cap =0 ;if ( !PyArg_ParseTupleAndKeywords (args, kwds, kwd_type, kwd_list, - &domid, &weight) ) + &domid, &weight, &cap) )return NULL ; sdom.weight = weight; + sdom.cap = cap;if (xc_sched_credit2_domain_set (self->xc_handle, domid, &sdom) !=0 )return pyxc_error_to_exception (self->xc_handle);@@ -1369,7 +1372,7 @@ static PyObject *pyxc_sched_credit2_domain_set(XcObject *self,static PyObject *pyxc_sched_credit2_domain_get (XcObject *self,PyObject *args) {uint32_t domid; -struct xen_domctl_sched_credit2 sdom; +struct xen_domctl_sched_credit2 sdom = { };if ( !PyArg_ParseTuple (args,"I" , &domid) )return NULL ;@@ -1377,8 +1380,8 @@ static PyObject *pyxc_sched_credit2_domain_get(XcObject *self, PyObject *args)if (xc_sched_credit2_domain_get (self->xc_handle, domid, &sdom) !=0 )return pyxc_error_to_exception (self->xc_handle); -return Py_BuildValue ("{s:H}" , -"weight" , sdom.weight); +return Py_BuildValue ("{s:HH}" , +"weight" ,"cap" , sdom.weight, sdom.cap); }static PyObject *pyxc_domain_setmaxmem (XcObject *self,PyObject *args)
Signature · 5 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel