anv: strdup the device path into the physical device
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 24 May 2016 18:02:18 +0000 (11:02 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 28 May 2016 00:18:33 +0000 (17:18 -0700)
This way we don't have to assume that the string coming in is a piece of
constant data that exists forever.

src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_private.h

index eb40e2d9b35e483bfb4ed829e964edc429b53f71..1ab6c745a26309d6b765d61691884abdcaaa50f6 100644 (file)
@@ -67,7 +67,9 @@ anv_physical_device_init(struct anv_physical_device *device,
 
    device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
    device->instance = instance;
-   device->path = path;
+
+   assert(strlen(path) < ARRAY_SIZE(device->path));
+   strncpy(device->path, path, ARRAY_SIZE(device->path));
 
    device->chipset_id = anv_gem_get_param(fd, I915_PARAM_CHIPSET_ID);
    if (!device->chipset_id) {
index b3774a88cb2aa9b70477a8836bd6a3e95d89a7d4..7325f3f5e61b2dd26fffb4c648319dc034cd8149 100644 (file)
@@ -542,7 +542,7 @@ struct anv_physical_device {
 
     struct anv_instance *                       instance;
     uint32_t                                    chipset_id;
-    const char *                                path;
+    char                                        path[20];
     const char *                                name;
     const struct brw_device_info *              info;
     uint64_t                                    aperture_size;