[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: Fix assignment of devid value returned from libxl__device_nextid



commit dfeccbeaa6536ceb3303380361b7ac18e1013292
Author:     Jim Fehlig <jfehlig@xxxxxxxx>
AuthorDate: Tue Jun 25 16:02:15 2013 -0600
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Jun 26 17:22:37 2013 +0100

    libxl: Fix assignment of devid value returned from libxl__device_nextid
    
    Commit 5420f265 has some misplaced parenthesis that caused devid
    to be assigned 1 or 0 based on checking return value of
    libxl__device_nextid < 0, e.g.
    
      devid = libxl__device_nextid(...) < 0
    
    This works when only one instance of a given device type exists, but
    subsequent devices of the same type will also have a devid = 1 if
    libxl__device_nextid succeeds.  Fix by checking the value assigned to
    devid, e.g.
    
      (devid = libxl__device_nextid(...)) < 0
    
    Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0612d85..1bbb990 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1781,7 +1781,7 @@ void libxl__device_vtpm_add(libxl__egc *egc, uint32_t 
domid,
     back = flexarray_make(gc, 16, 1);
 
     if (vtpm->devid == -1) {
-        if ((vtpm->devid = libxl__device_nextid(gc, domid, "vtpm") < 0)) {
+        if ((vtpm->devid = libxl__device_nextid(gc, domid, "vtpm")) < 0) {
             rc = ERROR_FAIL;
             goto out;
         }
@@ -2877,7 +2877,7 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t 
domid,
     back = flexarray_make(gc, 18, 1);
 
     if (nic->devid == -1) {
-        if ((nic->devid = libxl__device_nextid(gc, domid, "vif") < 0)) {
+        if ((nic->devid = libxl__device_nextid(gc, domid, "vif")) < 0) {
             rc = ERROR_FAIL;
             goto out;
         }
@@ -3258,7 +3258,7 @@ int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
     back = flexarray_make(gc, 16, 1);
 
     if (vkb->devid == -1) {
-        if ((vkb->devid = libxl__device_nextid(gc, domid, "vkb") < 0)) {
+        if ((vkb->devid = libxl__device_nextid(gc, domid, "vkb")) < 0) {
             rc = ERROR_FAIL;
             goto out;
         }
@@ -3359,7 +3359,7 @@ int libxl__device_vfb_add(libxl__gc *gc, uint32_t domid, 
libxl_device_vfb *vfb)
     back = flexarray_make(gc, 16, 1);
 
     if (vfb->devid == -1) {
-        if ((vfb->devid = libxl__device_nextid(gc, domid, "vfb") < 0)) {
+        if ((vfb->devid = libxl__device_nextid(gc, domid, "vfb")) < 0) {
             rc = ERROR_FAIL;
             goto out;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.