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

[Xen-changelog] [qemu-xen-traditional stable-4.6] hw/device-hotplug: fix test of drive_add() return



commit 2c69a0bb9e3b96bb041abf221323599976a4760c
Author:     Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
AuthorDate: Fri Mar 7 15:16:42 2014 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Oct 16 16:52:06 2015 +0100

    hw/device-hotplug: fix test of drive_add() return
    
    drive_opt_idx could be -1 in case error occurs inside drive_add, so the 
error
    check should be "if (drive_opt_idx < 0)" instead of original
    "if (!drive_opt_idx)".
    
    Signed-off-by: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
    Coverity-ID: 1055574
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 hw/device-hotplug.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
index 3bdc048..97d3529 100644
--- a/hw/device-hotplug.c
+++ b/hw/device-hotplug.c
@@ -34,7 +34,7 @@ int add_init_drive(const char *opts)
     int ret = -1;
 
     drive_opt_idx = drive_add(NULL, "%s", opts);
-    if (!drive_opt_idx)
+    if (drive_opt_idx < 0)
         return ret;
 
     drive_idx = drive_init(&drives_opt[drive_opt_idx], 0, current_machine);
--
generated by git-patchbot for /home/xen/git/qemu-xen-traditional.git#stable-4.6

_______________________________________________
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®.