[Mesa-dev] [PATCH v2 6/6] i965: Don't write past the end of the application supplied buffer
Kenneth Graunke
kenneth at whitecape.org
Thu Mar 5 20:46:47 PST 2015
On Wednesday, March 04, 2015 09:55:46 AM Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Both the AMD and Intel APIs provide a dataSize parameter, and this
> function would merrily ignore it. Neither API specifies what to do when
> the buffer isn't big enough. I take the easy route of writing all the
> complete bits of data that will fit. With more complete specs, we could
> probably do something different.
>
> I noticed this while looking into an unused parameter warning. The
> warning was actually useful!
>
> brw_performance_monitor.c: In function 'brw_get_perf_monitor_result':
> brw_performance_monitor.c:1261:37: warning: unused parameter 'data_size' [-Wunused-parameter]
> GLsizei data_size,
> ^
>
> v2: Fix checks to include offset in the calculation. Noticed by Jan.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Jan Vesely <jan.vesely at rutgers.edu>
Huh. I could've sworn I reviewed this patch a while back, but I can't
find any evidence of that. Thanks for fixing this!
The spec isn't particularly clear about whether we should write up to
the very end of the byte limit (i.e. write the group name and counter
name but not the value), or omit the entire last entry when there isn't
space...but I think what you did is quite sensible.
I'm pretty sure we're deleting most of this code in favor of Rob's
efforts, but we may as well land this fix in the meantime.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150305/598c84a3/attachment.sig>
More information about the mesa-dev
mailing list