If we plow on after udev_device_get_syspath fails, we will hit a NULL
dereference. Clang found one due to strdup later in udevSetParent,
but in fact we hit a NULL dereference sooner because of the use of
STREQ within virNodeDeviceFindBySysfsPath.
* src/conf/node_device_conf.h (virNodeDeviceFindBySysfsPath): Mark
path argument non-null.
* src/node_device/node_device_udev.c (udevSetParent): Avoid null
dereference.
/*
* node_device_conf.h: config handling for node devices
*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* Copyright (C) 2008 Virtual Iron Software, Inc.
* Copyright (C) 2008 David F. Lively
*
const char *name);
virNodeDeviceObjPtr
virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
- const char *sysfs_path);
+ const char *sysfs_path)
+ ATTRIBUTE_NONNULL(2);
virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
const virNodeDeviceDefPtr def);
parent_sysfs_path = udev_device_get_syspath(parent_device);
if (parent_sysfs_path == NULL) {
- VIR_DEBUG("Could not get syspath for parent of '%s'",
- udev_device_get_syspath(parent_device));
+ virNodeDeviceReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not get syspath for parent of '%s'"),
+ udev_device_get_syspath(parent_device));
+ goto out;
}
dev = virNodeDeviceFindBySysfsPath(&driverState->devs,