xf86drm: ensure proper alignment of pointers in drmProcessPciDevice
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 13 May 2016 06:11:13 +0000 (01:11 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 10 Jun 2016 18:15:15 +0000 (20:15 +0200)
Previously, (*device)->businfo.pci would end up misaligned, which results
in undefined behavior.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
xf86drm.c

index 4fdcaf8..804a413 100644 (file)
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3000,7 +3000,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
                                const char *node, int node_type,
                                int maj, int min, bool fetch_deviceinfo)
 {
-    const int max_node_str = drmGetMaxNodeName();
+    const int max_node_str = ALIGN(drmGetMaxNodeName(), sizeof(void *));
     int ret, i;
     char *addr;