[PATCH] xf86drm: ensure proper alignment of pointers in drmProcessPciDevice

Nicolai Hähnle nhaehnle at gmail.com
Fri May 13 06:14:36 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Previously, (*device)->businfo.pci would end up misaligned, which results
in undefined behavior.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 xf86drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xf86drm.c b/xf86drm.c
index 5f587d9..94efc08 100644
--- 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;
 
-- 
2.7.4



More information about the dri-devel mailing list