[libvirt] [PATCH 5/5] esxVMX_GatherSCSIControllers: avoid NULL dereference

Jim Meyering jim at meyering.net
Wed Apr 14 08:46:08 UTC 2010


From: Jim Meyering <meyering at redhat.com>

* src/esx/esx_vmx.c (esxVMX_GatherSCSIControllers): Do not dereference
a NULL disk->driverName.  We already detect this condition in another
case.  Check for it here, too.
---
 src/esx/esx_vmx.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index 647e720..aed5cc1 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -570,11 +570,12 @@ esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],

         if (virtualDev[controller] == NULL) {
             virtualDev[controller] = disk->driverName;
-        } else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
+        } else if (disk->driverName == NULL
+                   || STRCASENEQ(virtualDev[controller], disk->driverName)) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       _("Inconsistent driver usage ('%s' is not '%s') on SCSI "
                         "controller index %d"), virtualDev[controller],
-                      disk->driverName, controller);
+                      disk->driverName ? disk->driverName : "?", controller);
             return -1;
         }
     }
-- 
1.7.1.rc1.248.gcefbb




More information about the libvir-list mailing list