]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Add check to avoid a NULL compare for SysfsPath
authorCheng Lin <cheng.lin130@zte.com.cn>
Fri, 18 Jan 2019 07:49:37 +0000 (15:49 +0800)
committerCole Robinson <crobinso@redhat.com>
Thu, 24 Jan 2019 22:31:32 +0000 (17:31 -0500)
commitd2edbec2bf281025f27646d61d3b7ec3ed662f5d
tree9e9731211957d153dff675942977445d1b61653d
parentca768886d8a9ea526b67055c753cef3cf7d99e2d
conf: Add check to avoid a NULL compare for SysfsPath

If the two sysfs_path are both NULL, there may be an incorrect
object returned for virNodeDeviceObjListFindBySysfsPath().

This check exists in old interface virNodeDeviceFindBySysfsPath().
e.g.
virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
                             const char *sysfs_path)
{
    ...
        if ((devs->objs[i]->def->sysfs_path != NULL) &&
            (STREQ(devs->objs[i]->def->sysfs_path, sysfs_path))) {
    ...
}

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Cheng Lin <cheng.lin130@zte.com.cn>
src/conf/virnodedeviceobj.c