On Thursday, July 6, 2017 4:21:28 AM PDT Chris Wilson wrote:
> Quoting Kenneth Graunke (2017-07-05 21:56:53)
> > diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
> > b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> > index a9ac29a6a81..2b0f7b9a698 100644
> > --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> > +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
> > @@ -289,7 +289,10 @@ brw_get_buffer_subdata(struct gl_context *ctx,
> >     if (brw_batch_references(&brw->batch, intel_obj->buffer)) {
> >        intel_batchbuffer_flush(brw);
> >     }
> > -   brw_bo_get_subdata(intel_obj->buffer, offset, size, data);
> > +
> > +   void *map = brw_bo_map(brw, intel_obj->buffer, MAP_READ);
> 
> Be paranoid and wrap this in a if (map). Data pointer is provided by the
> user? otherwise you probably want to memset it on failure.
> 
> > +   memcpy(data, map + offset, size);
> > +   brw_bo_unmap(intel_obj->buffer);
> >  
> >     mark_buffer_inactive(intel_obj);
> >  }

I suppose the paranoia is reasonable, but I'm not sure why I'd memset
it on failure...unless you're suggesting filling it with 0xd0d0d0d0 or
something to aid in debugging.  The only reasonably legitimate error
handling I can think of is to raise GL_OUT_OF_MEMORY, at which point
we may as well not write anything...

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to