[PATCH] glx: fixup deref of null pointer when glx screen init fails.

Luc Verhaegen libv at skynet.be
Fri Oct 2 07:28:54 PDT 2009


On Fri, Oct 02, 2009 at 01:18:22PM +0200, Luc Verhaegen wrote:
> On Thu, Oct 01, 2009 at 10:50:09AM -0700, Ian Romanick wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Dave Airlie wrote:
> > > From: Dave Airlie <airlied at linux.ie>
> > > 
> > > I think this is what the original author wanted.
> > > 
> > > Signed-off-by: Dave Airlie <airlied at redhat.com>
> > 
> > Acked-by: Ian Romanick <ian.d.romanick at intel.com>
> > 
> > I can't believe this got by Jesse and Kristian when they reviewed the
> > original patch.  I need to go clean the egg off my face...
> > 
> > > ---
> > >  glx/glxext.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/glx/glxext.c b/glx/glxext.c
> > > index 2de8b84..0737420 100644
> > > --- a/glx/glxext.c
> > > +++ b/glx/glxext.c
> > > @@ -364,14 +364,14 @@ void GlxExtensionInit(void)
> > >  
> > >  	    glxScreen = p->screenProbe(pScreen);
> > >  	    if (glxScreen != NULL) {
> > > +	    	if (glxScreen->GLXminor < glxMinorVersion)
> > > +		    glxMinorVersion = glxScreen->GLXminor;
> > >  		LogMessage(X_INFO,
> > >  			   "GLX: Initialized %s GL provider for screen %d\n",
> > >  			   p->name, i);
> > >  		break;
> > >  	    }
> > >  
> > > -	    if (glxScreen->GLXminor < glxMinorVersion)
> > > -		glxMinorVersion = glxScreen->GLXminor;
> > >  	}
> > >  
> > >  	if (!p)
> 
> Why is this chunk there in the first place? It feels as if it has no 
> direct connection to the commit message of ad5c0d9efa, namely:
> 
>   GLX: Enable GLX 1.4 on DRI2
>     
>   Return the minimum GLX version supported by all screens.  Assume that
>   DRI2 screens have all the required features for GLX 1.4.  Assume that
>   everyone else can only support GLX 1.2.
> 
> or that it was not mentioned.
> 
> glxMajor/MinorVersion are only set for DRI and are never altered or used 
> for DRI2.
> 
> >From what i see in the original patch; for DRI, GLXscreen->GLX???or is 
> set to 1.2; for DRI2 it is set to 1.4, while glx???orVersion is set to 
> 1.2. With these current versions out there, this extra code seems to 
> have no result and the version string will always read 1.2.
> 
> What is this trying to achieve or could it be that the < should be a > 
> so that the version string returns 1.4 for DRI2?
> 
> Luc Verhaegen.

Ok, thinking about this a bit further, and noticing that i overlooked 
the imho gratuitous version bump, i came up with the attached patch.

In order to have this evaluated ASAP, i haven't set up an up to date 
environment where i can build Xorg master yet, so this patch was not 
even build tested.

Luc Verhaegen.
-------------- next part --------------



More information about the xorg-devel mailing list