drm: Branch 'master'

[email protected] (Michel D??nzer)
Newsgroups gmane.comp.video.dri.patches
Message-ID <[email protected]>
 xf86drm.c |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 3045523de214fb7df92ee3c8482e883637504bbe
Author: Michel Dänzer <[email protected]>
Date:   Wed Oct 14 12:48:52 2015 +0900

    Fix void pointer arithmetic in drmProcessPciDevice
    
    Arithmetic on void pointers is a GCC extension.
    
      CC       libdrm_la-xf86drm.lo
    ../xf86drm.c: In function 'drmProcessPciDevice':
    ../xf86drm.c:3017:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
         addr += sizeof(drmDevice);
              ^
    ../xf86drm.c:3020:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
         addr += DRM_NODE_MAX * sizeof(void *);
              ^
    ../xf86drm.c:3023:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
             addr += max_node_str;
                  ^
    ../xf86drm.c:3035:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
             addr += sizeof(drmPciBusInfo);
                  ^
    
    Reviewed-by: Alex Deucher <[email protected]>

diff --git a/xf86drm.c b/xf86drm.c
index 27313cc..a29db42 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3001,21 +3001,22 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
 {
     const int max_node_str = drmGetMaxNodeName();
     int ret, i;
-    void *addr;
+    char *addr;
 
-    addr = *device = calloc(1, sizeof(drmDevice) +
-                               (DRM_NODE_MAX *
-                                (sizeof(void *) + max_node_str)) +
-                               sizeof(drmPciBusInfo) +
-                               sizeof(drmPciDeviceInfo));
+    *device = calloc(1, sizeof(drmDevice) +
+		     (DRM_NODE_MAX * (sizeof(void *) + max_node_str)) +
+		     sizeof(drmPciBusInfo) +
+		     sizeof(drmPciDeviceInfo));
     if (!*device)
         return -ENOMEM;
 
+    addr = (char*)*device;
+  
     (*device)->bustype = DRM_BUS_PCI;
     (*device)->available_nodes = 1 << node_type;
 
     addr += sizeof(drmDevice);
-    (*device)->nodes = addr;
+    (*device)->nodes = (char**)addr;
 
     addr += DRM_NODE_MAX * sizeof(void *);
     for (i = 0; i < DRM_NODE_MAX; i++) {
@@ -3024,7 +3025,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
     }
     memcpy((*device)->nodes[node_type], node, max_node_str);
 
-    (*device)->businfo.pci = addr;
+    (*device)->businfo.pci = (drmPciBusInfoPtr)addr;
 
     ret = drmParsePciBusInfo(maj, min, (*device)->businfo.pci);
     if (ret)
@@ -3033,7 +3034,7 @@ static int drmProcessPciDevice(drmDevicePtr *device, const char *d_name,
     // Fetch the device info if the user has requested it
     if (fetch_deviceinfo) {
         addr += sizeof(drmPciBusInfo);
-        (*device)->deviceinfo.pci = addr;
+        (*device)->deviceinfo.pci = (drmPciDeviceInfoPtr)addr;
 
         ret = drmParsePciDeviceInfo(d_name, (*device)->deviceinfo.pci);
         if (ret)

------------------------------------------------------------------------------

--
_______________________________________________
Dri-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.