[Mesa-dev] [PATCH v2 2/2] i965: Fix invalid pointer read in dead_control_flow_eliminate().

Jason Ekstrand jason at jlekstrand.net
Mon Apr 4 17:56:54 UTC 2016


On Mon, Apr 4, 2016 at 10:23 AM, Kenneth Graunke <kenneth at whitecape.org>
wrote:

> On Monday, April 4, 2016 12:19:57 AM PDT Jason Ekstrand wrote:
> > On Sun, Apr 3, 2016 at 10:56 PM, Kenneth Graunke <kenneth at whitecape.org>
> > wrote:
> >
> > > There may not be a previous block.  In this case, there's no real work
> > > to do, so just continue on to the next one.
> > >
> > > v2: Update for bblock->prev() API change.
> > >
> > > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > > ---
> > >  src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> > > b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> > > index 2c1abaf..114dc6c 100644
> > > --- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> > > +++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> > > @@ -42,6 +42,10 @@ dead_control_flow_eliminate(backend_shader *s)
> > >
> > >     foreach_block_safe (block, s->cfg) {
> > >        bblock_t *prev_block = block->prev();
> > > +
> > > +      if (!prev_block)
> > > +         continue;
> > > +
> > >        backend_instruction *const inst = block->start();
> > >        backend_instruction *const prev_inst = prev_block->end();
> > >
> >
> > Yeah, that guy right there will be a problem on the first loop iteration
> > every time.  I've seen this in valgrind quite a bit lately.  Thanks for
> > fixing it!
> >
> > Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
> >
> > Maybe Cc stable?
> > --Jason
>
> I checked 10.2 on the first spin of this series, and I didn't see the
> valgrind errors there.
>

Sounds good
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160404/a4d8e888/attachment.html>


More information about the mesa-dev mailing list