xserver: Branch 'master' - 3 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Feb 5 20:45:22 UTC 2018


 hw/xfree86/common/xf86Configure.c   |    5 +++--
 hw/xfree86/common/xf86platformBus.c |    7 ++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit fd21b282dc88936043a23baa4ec053a2811319a7
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Sun Feb 4 23:17:54 2018 -0600

    xfree86: Only call PreInit handler if it exists for device
    
    DoConfigure() attempts to call the PreInit handler on a device without
    checking that the handler exists.
    
    Check that the PreInit handler exists for a device before attempting to
    call it.
    
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 1b1928b17..44e759166 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -774,7 +774,8 @@ DoConfigure(void)
 
         ConfiguredMonitor = NULL;
 
-        if ((*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
+        if ((*xf86Screens[dev2screen[j]]->PreInit) &&
+            (*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
                                                     PROBE_DETECT) &&
             ConfiguredMonitor) {
             monitor_ptr = configureDDCMonitorSection(j);
commit e81031f3fda0f8b4237224b13c016759eaa52449
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Sun Feb 4 23:17:53 2018 -0600

    xfree86: Allocate sufficienct space for dev2screen array
    
    When the dev2screen is sized to xf86NumDrivers in DoConfigure(),
    subsequent code may attempt to write past the end of the array.
    
    Size the dev2screen array to nDevToConfig instead.
    
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index 672cfd6e8..1b1928b17 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -702,7 +702,7 @@ DoConfigure(void)
 
     xf86DoConfigurePass1 = FALSE;
 
-    dev2screen = xnfcalloc(xf86NumDrivers, sizeof(int));
+    dev2screen = xnfcalloc(nDevToConfig, sizeof(int));
 
     {
         Bool *driverProbed = xnfcalloc(xf86NumDrivers, sizeof(Bool));
commit 1a24a0ae7b1a7400735530a21ac8c0247723223d
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Sun Feb 4 23:17:52 2018 -0600

    xfree86: Do not use uninitialized pointer during probe
    
    Commits b5dffbb and d75ffcd introduce code in xf86platformProbe() that
    references a member of xf86configptr.  However, when using the
    "-configure" option, xf86configptr may not be initialized when
    xf86platformProbe() is called.
    
    Avoid referencing a member of xf86configptr if uninitialized.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100405
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 844bf7e93..cef47da03 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -276,7 +276,8 @@ xf86platformProbe(void)
 {
     int i;
     Bool pci = TRUE;
-    XF86ConfOutputClassPtr cl;
+    XF86ConfOutputClassPtr cl, cl_head = (xf86configptr) ?
+            xf86configptr->conf_outputclass_lst : NULL;
     char *old_path, *path = NULL;
 
     config_odev_probe(xf86PlatformDeviceProbe);
@@ -296,7 +297,7 @@ xf86platformProbe(void)
          * Deal with OutputClass ModulePath directives, these must be
          * processed before we do any module loading.
          */
-        for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+        for (cl = cl_head; cl; cl = cl->list.next) {
             if (!OutputClassMatches(cl, &xf86_platform_devices[i]))
                 continue;
 
@@ -317,7 +318,7 @@ xf86platformProbe(void)
     /* First see if there is an OutputClass match marking a device as primary */
     for (i = 0; i < xf86_num_platform_devices; i++) {
         struct xf86_platform_device *dev = &xf86_platform_devices[i];
-        for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
+        for (cl = cl_head; cl; cl = cl->list.next) {
             if (!OutputClassMatches(cl, dev))
                 continue;
 


More information about the xorg-commit mailing list