From: Kaifeng Zhu <kaifeng....@citrix.com> 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....@citrix.com> Coverity-ID: 1055574 Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com> --- hw/device-hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel